Last week we covered how to add a global menu item in SugarCRM 7. Today we will expand on that example by passing data to the menu item to make the URL built specifically for the user who is currently logged in.
In this SugarCRM instance a custom field has been created in Studio called “wiki_user_c”. This is what we need to pass along to the view in order to display the correct URL. To pull that data, the first step is to copy over /clients/base/views/profileactions/profileactions.js to /custom/clients/base/views/profileactions/profileactions.js. Within that file we alter setCurrentUserData to pull over our custom field:
The next step is to tell the app how to load that field via the API. The new client API makes it really simple to extend any method. In this case, we want to extend the retrieveCurrentUser method from CurrentUserApi. In the example bleow, our endpoint is first registered. The below in retrieveCurrentUser() some code is thrown down to pull and pass that data along. Since this is extending a core API make sure to call the parent so that no existing functionality is affected.
/custom/clients/base/api/WikiCurrentUserApi.php:
Finally, alter the .hbt template in /custom/clients/base/views/profileactions/profileactions.hbt to use the new wiki_user variable:
Run a Quick Repair & Rebuild and then refresh the browser to see the changes. The rebuild will cache our custom endpoint in /cache/include/api/ServiceDictionary.rest.php and will be given a score to help give it preference over any other endpoint. In this case, the default CurrentUserApi endpoint.

The big issue that we face with this method of altering the profileactions view in the custom directory is that someone down the road may also customize that view. Similarly, our solution may completely overwrite an already existing profileactions change on a given SugarCRM instance.
To minimize these potential issues we'll look at a few different options next week including extending the core javascript object and defining a new view to be loaded in place of profileactions.
-
Duplicate Detector
Find Duplicates BEFORE You Save! Instead of waiting until after you enter a new record's information to know if it's a duplicate, know after the first field if you're working on a duplicate. Say NO to redundant data! Improve your SugarCRM data quality by being prompted of duplicate values while ...
-
SMS Integration with SugarCRM
SMS add-on automation makes your business available anytime. Send SMS from SugarCRM at one click from any module. You can also create workflow SMS and get a reply back as an Inbound SMS.
-
OpenCart Integration with SuiteCRM
SuiteCRM Opencart Integration is seamless and real-time, no dependency on admin to run a Cron job to pull or push data. “Once the information is keyed in one system it will push data to other systems instantaneously”
- Show more addons
Keep up to date on the latest additions