In the pre-7.x world, some customizations that can now be implemented natively via the Sugar 7.x framework used to require the use of SugarLogic functionality or inclusion of third party JavaScript libraries. The case of SugarLogic can be particularly problematic if one utilizes a large number of such customizations, as it might imply the execution of additional server side code. The greater the number of these type of customizations and the greater the potential to introduce performance problems. This is also true for logic hooks. For example, a hook that automatically converts the last name field to upper case upon a record being saved.
If we step back and analyze these customizations, we would likely find that some could be implemented via JavaScript. Doing so would in turn offload some of the server load to the client -- likely helping correct performance problems. The latter example of the logic hook upper casing the last name field is a good case in point.
Suppose we wanted to convert such a customization to implement it through JavaScript instead of using a logic hook. How would we do that?
The general idea would be to use a standard onBlur() event, tied to the last_name field of a module such as Contacts and then automatically updating the content of that same field when focus is lost.
As it turns out, the Sugar 7.x framework makes this a very easy task. The code for making such a customization is found below:
I hope you find it helpful!
Hey man,
ReplyDeleteI'm try using your code in Lead module, but not work. what's wrong with code ?
I'm using sugarcrm 7.6
The module shouldn't matter, so long as you've placed the file in the proper directory.
DeleteWithout seeing your code and/or knowing where you placed it, it is a bit difficult to provide further assistance.
Great tip! Thank you.
ReplyDeleteGreat tip! Thank you.
ReplyDeleteHi Angel,
ReplyDeleteWhat if I want to run the default duplicate checker of SugarCRM 7 manually from the function doUpperLast?
is it achievable?
Hi Angel,
ReplyDeleteGreat thing to know ,
I used it on Subpanel-list.js and it worked like a charm
Can you please let me know , how we can pass parameter to this function?
Thanks,
Ketan B