If you're familiar with SugarCRM version 7.x, you have probably seen the Case Summary dashlet on the Account's module that displays a chart to show you Open/Closed cases related to an Account record separated out by status.
We recently customized the Cases module by adding additional relationships to other custom modules that relate to a Case. Our customer wanted to be able to see this dashlet on those custom module so users can also see how many Cases these records have.
In order to do this customization, you will need to do the following:
- Create a new folder in the custom/clients/base/views directory. In our scenario, we created a folder called customer-cases.
- Copy the files within the clients/base/views/casesummary directory and paste them into your folder your created in step 1. There will be 3 files here that need to be copied over (JS, PHP, and HBS file extensions).
- Rename the files you pasted into your directory to match the folder name you created in step 1.
- Open up the JS file and look for the following line within the code. This code will be near the end of the file.
- You should see a reference to the account_id field, the Accounts module, and the Cases module. These 3 references will need to be updated to point to your custom module you want this dashlet to be available for as well as the relationship and relationship id names between that module and the Cases module. Below is what our code update for our customer-cases looks like.
- Now open up the PHP file in your folder.
You'll need to modify a few lines within this definition. Update the ['casesummary'] and replace the casesummary with your folder name you created in step 1. Update your Label if you want the Dashlet title to be something different than the default. The last thing here you will need to update is the filter module definition. Change this from Accounts to your custom module.
- Run a Repair/Rebuild on your instance and make sure the cache directory is cleared out.
- Navigate to your custom module you want to display the dashlet on and within the side panel of a record, add a new Dashboard to the panel. You should now see your Case Summary dashlet available to choose from. Select the Dashlet from the view.
- You should now have the dashlet displaying and showing the current records relationship to open/closed cases!