Exploring Microsoft Dynamics CRM system Js files

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.

image

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.

image

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

 

image

 

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!

Advertisements

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

One thought on “Exploring Microsoft Dynamics CRM system Js files”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s