Tips and Tricks about Calling function in Custom Content of Sage CRM 7.2

By | December 8, 2014

Even from Technical Point of view Sage CRM is very much capable to handle various critical solutions. We have already posted few blogs about writing JavaScript codes in .js files and calling the same in Custom Content of any screen. This blog explains such a nice and timesaving trick to call JavaScript function written in any JavaScript file under root directory of CRM.
New Stuff: Make your keyword search more efficient
Normally I follow mechanism where I used to create a new JavaScript file under root directory of CRM, write all client side code in it and then call the function by specifying function name and path of the file in Custom Content. Below screenshot will give you clear idea about what I am talking.
While working on Sage CRM, I came across one scenario where my Case entity functionality was working fine on Internet Explorer browser but not in Chrome. That functionality was totally based on code written in one of the JavaScript function and through Custom Content of the screen I was calling the same.
I tried couple of basic solutions like to check language syntax, file path etc. but none of these were working. After debugging the code and from internet help I came to know about one new feature which will be a great help for any developer of course if he doesn’t know about this. 🙂
Basically the idea is to create JavaScript file under CRM root directory i.e. at “WWWRoot\js\custom”. Write all your functions here and then you just need to specify function name in Custom Content of any screen and not the path of the file. This is applicable throughout the CRM for any screen and the biggest advantage is, it works in every major browser like IE, Chrome, firefox etc. without any flaw. I just use below JavaScript syntax and put it Custom Content of screen “CaseDetailBox”. Refer below sample code snippet.
if(typeof window.addEventListener != ‘undefined’)
window.addEventListener(“load”,SMTCase, false);
else if(window.attachEvent)
Also Read:
1) Use of AttachEvent on window in Custom Content
2) How do you find the Workflow Action Buttons from custom content?
3) How do you call the custom page to write your custom content?
4) JavaScript to Calculate days difference between dates (Duration)
5) Run the External JavaScript file in 64-bit Operating system