This post is about how to create a new dashlet for activity modules (Calls, Tasks, and Meetings) that will show a preview of the parent record for the activity in record view.

There are four files required for this customization. Three are related to the dashlet and one is a language file.

One important note for Sugar 7 dashlets is the directory and the .php, .js, and .hbs files must have the same name. So if you had a dashlet called hello-world you would need:

  • Directory hello-world
  • hello-world/hello-world.php
  • hello-world/hello-world.js
  • hello-world/hello-world.js

Since this dashlet will be used for multiple modules the dashlet files are located in ‘custom/clients/base/views/’.

The php file defines the dashlet filters. We want the dashlet to be available in the Calls, Tasks, and Meetings modules Record View so we add definition in the dashlet filter.

‘custom/clients/base/views/activity-parent-record/activity-parent-record.php’


Next the javascript file checks if the activity record has a parent record associated with it. If it does we do an api call to get the object of that parent record.  It would probably be wise to add a check to see if the parent module type is one you are looking to show a preview of but I didn’t in this case because most users don’t have access to them (Cases for example). 

‘custom/clients/base/views/activity-parent-record/activity-parent-record.js’
 

The handlebars template is where the dashlet view is set. In this instance Accounts and Opportunities as those are the primary modules used. This template shows some custom fields for this instance so you should remove those if you use this. I also already have a logic hook that displays the parent phone number on the call record. If that isn’t the case it would be very beneficial to add that to the template. Remember you’ll have to change depending on the parent module type.

‘custom/clients/base/views/activity-parent-record/activity-parent-record.hbs’
Lastly we need to add the language file that will update the dashlet name in when going to add it along with the description.

‘custom/Extension/application/Ext/Language/en_us.activity_call_parent.php’

 

Something I didn’t do but that would add some nice functionality would be to do another api call to try to get the notes associated with the parent module. I decided not to do this because the dashlet was intended to give a quick preview. I added the button to open the record at the bottom of the dashlet if the user needs more information. It would be interesting to see that similar to the preview from list view shows the related records in the intelligence pane.

Hope this slightly more advanced dashlet (compared to the proof of concept ones) helps someone if they want to create a dashlet like this or their own dashlet.

Categories: Uncategorized

Related Posts

Sugar Outfitters

Background Updater for SugarCRM Version 2

Background Updater for SugarCRM version 2 now available.

Uncategorized

Dashboard Manager Now for SugarCRM 7

We have just updated our Dashboard Copy Manager to be compatible with SugarCRM 7 On-Demand. Dashboard Copy Manager allows admins to quickly copy Home, List View, and Record View dashboards to Users, Teams, and Roles. Read more…

Uncategorized

Conditionally Disable Editing in SuiteCRM Based On Field Value

A common customization for SuiteCRM is controlling the user behavior while editing records. A couple of examples are forcing a field to be filled based another field value, updating a field based on the input Read more…