How to bind a dashlet to custom data

Hi guys,
What is the procedure to bind a dashlet to data say a Json array. I will appreciate any leads to links, examples or sample code.
Thanks in advance

If you take a look at modules/Opportunities/Dashlets/MyClosedOpportunitiesDashlet
That is one of the simplest dashlet which will help you understand the working of it.

For example, the processing and parsing of your Json array will take place in MyClosedOpportunitiesDashlet.php
You would send the results over to MyClosedOpportunitiesDashlet.tpl where you’ll construct a view for your dashlet.

You will need to know a thing or two about smarty templates which can be found at http://www.smarty.net/ or anywhere on google for that matter.

1 Like

This turned out well for me. I appreciate. Thanks a lot.

Hi there,
I have gone through the smarty templating engine and understood its way of separating the funtionality (.php file) from the presentation (.tpl file). Seeing that SuiteCrm uses smarty, I have a question regarding how the custom modulebuilder works. As per the project structure as shown in phpStorm, the creation of a module is mapped to the path custom-> modulebuilder->builds->CUSTOM_MODULE_NAME. Inside one of the CUSTOM_MODULE_NAME, I can see several directories. These include SugarModules and icons. There is also a license.txt file and a manifest.php file. In the SugarModules folder, there is the language and modules directory. Inside the modules directory, there is a folder that is prefixed with the key name of the module and inside that folder we have the Dashlets, language, metadata folders and some php files including Menu.php and vardefs.php. At the moment I don’t know where the listviews are and will appreciate some guidance on this part.

I would like to edit the php file for listviews and dashlets created using the module builder. As such i can be able to bind my associative array which i have created from a json to my dashlets, listviews and dynamic dropdowns. I need a way to do this. Kindly explain where i can locate the .tpl and .php files for the listviews, dashboards and dynamic dropdowns created using module builder so that i can be able to edit the php file to get my data and use it in the corresponding tpl file. Additionaly, kindly adivise whether this method is upgrade safe. Any other advise on how to do this is very much welcome.

Thanks in advance.

The advantage of this is that I will be able to take advantage of the default styling with bootstrap that comes with suitecrm, as opposed to creating a directory with my php (where i can fetch the data as a json and transfer it to the tpl as an associative array) and tpl where i get to display the data. Please advise so that i dont have to write my own styles.