I find myself needing the same jscript over and over again when I build out demos. To make life easier I decided to create a function library that I can attach to any CRM form. Here it is. I will add to this over time.
If you have any useful functions that should be included post them in the comments and I’ll incorporate them. The jscript is available here and below. At the end of this post you will see some examples demonstrating the use of these functions.
Warning: these functions are of a ‘demo’ standard, and should be hardened and tested before used in a production setting.
Here are some examples where I utilise the above functions:
To reference the jscript library on a CRM form add the shared function library web resource to the Form and then add a form-specific jscript library web resource after that. It is in this second jscript file that your form logic will sit and where you will make function calls against the shared functions library:
To reference the jscript library within a custom Ribbon button’s definition either;
simply reference the library on the form:
or, you can reference the library within the ribbon definition: