For a long time doing this, however thought of sharing this to all you guys. CRM does a lot of whole lot of functionalities using these javascript files.
When do we really need to explore these system files functions. Well as a CRM consultant, frequently i have faced scenarios where the customer is very adamant about a particular requirement which cannot be achieved OOB in CRM using SDK Documented API’s and they are not happy with the workarounds that we provide. Off-course the customer also has a point to stick to their requirements since they also want a system that would most fit their business. Well let’s jump to the solution then.
Well for our example lets take the RibbonActions.js file. A lot of CRM functionalities is done through the ribbons. Well a bit of exploration and you would find that most of the Ribbon functionalities, CRM achieves through the RibbonActions.js file located in <CRM Installation Folder>/CRMWeb/_static/_common/scripts.
When I open that file in the notepad, the following is what the script looks like.
Scary right. This is because CRM minifies their javascript files removing line breaks, white spaces etc. which effectively improves performance. Well here our target is to explore the library. For that first let me convert into a more readable format. To do this you will have multiple free jScript formatters available but personally I have always liked the jsBeautifier tool which is available for download from http://jsbeautifier.org/
I copy the contents, paste it in the jsBeautifier tool. Below is the screenshot of what i get after i beautify it.
Now it is in much more readable format and as you can see you have all the utility methods the CRM uses internally which you can utilize off if and at all required. Please note that these are system functions and might not work after installing update rollups at any point of time.
Keep a copy of the original file and if you want to explore what parameters are passed when you click a ribbon button, simply replace the contents with the formatted version. You can then even debug these system functions and see what parameters are being passed by CRM to these functions. Do not put a debugger in code. You can simply debug using IE Devloper toolbar or Chrome debugger.
In the screenshot below, I am using the Chrome debugger to explore the CRM system file globalquickcreatebehavior.js
Please note: This article as the name suggests is only for exploring the CRM system js files Do not replace the minified version of js file with the formatted version. CRM minifies the files because of the performance issue. Also tampering the system files might render your application not being supported by Microsoft. At best it can be used for debugging in dev. and for POC purpose. Always maintain a back up of the original file before you replace the contents.
Hope this helps!
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.
Pingback: Close Quick Create Form in Microsoft Dynamics CRM 2013. | Debajit's Dynamic CRM Blog