Custom Modules – Pimping your dashlet

I recently needed to add some custom functionality to a Dashlet for a Custom Module in SugarCRM and this is the story of how I did it.

Let’s say your custom module is called MyModule and you have build it in Studio.

The folder where you would work your magic would be located at /custom/modules/MyModule/Dashlets/MyModuleDashlet/

In there you should find two files – MyModuleDashlet.meta.php and MyModuleDashlet.php

MyModuleDashlet.meta.php basically does what it says on the tin, i.e. it tells Sugar about your dashlet – which module it relates to, it’s title, description, icon and category.

MyModuleDashlet.php is where you can do your kung fu.  Just as a brief example in the “process” function try setting the “title” property to something like “HELLO WORLD”:

function process(){

$this->title = “HELLO WORLD”;

}

If you want to modify the default Dashlet title or any other of the labels for your dashlet you can create a file in /custom/modules/MyModule/language/en_us.lang.php – if you don’t have the file present then you can copy it across from /modules/MyModule/language/

Go to the admin area, Repair, Rebuild Dashlets and see what happens.

Advertisements
Posted in SugarCRM
One comment on “Custom Modules – Pimping your dashlet
  1. Cado Magenge says:

    An interesting post! Thanks for sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: