Follow Us:
In this blog I am going to give you a brief explanation about how to use JavaScript libraries at the form level as well as how to create new JavaScript libraries in Microsoft Dynamics CRM 2013 and 2015.
To use JavaScript library at the form level follow the steps outlined below:
1. Login to CRM then go to Settings=>Customization=>Customize the system.
2. Inside solution select entity and click on forms
3. Click on Main form
4. Inside form click on Form Properties in Ribbon Bar
5. Once you click on Form Properties a new window opens. In that window click on the Event Tab
6. The event tab shows all of the JavaScript libraries related to the form. To add a new JavaScript library click on Add.
7. After clicking on add a new window opens. If you already have the JavaScript file in the CRM system, search for that file and click on Add, otherwise click on New.
8. After clicking on the New button another window opens. Fill in all of the information in that window, then select save and publish. This process creates a new web resource in the system.
9. To add your code for this JavaScript web resource click on Text editor and copy all of the JavaScript code inside the Text Editor. Or you can upload your JavaScript file here as well, by clicking on the browse button and browsing for your file, once you're done click on Save then Publish button and close record.
10. After this on Form Properties you can see that your new web resource is listed under form Libraries.
11. To add JavaScript functions on the form we can call those functions on respective events like OnLoad, On Save and OnChange. On Load and On Save are set with respect to forms while on Change can be set with respect to fields, Tabs of the form.
12. For example to call an event for OnLoad of the form go to Control select form then set event to “OnLoad” and click on Add.
13. Once you click on Add, from library drop down Select your library (same library which contains your JavaScript code) and write your function name inside function field and click on OK.
This example is for OnSave type of event.
14. To call an event on OnChange of fields go to control select name of the field and click on Add, After this repeat step 13
Once its done close form properties, save and Publish CRM form.
For more information about this blog or C5 Insight, contact us here!
The complementary paper includes over 12 years of research, recent survey results, and CRM turnaround success stories.
Request Download
This 60-second assessment is designed to evaluate your organization's collaboration readiness.
Learn how you rank compared to organizations typically in years 1 to 5 of implementation - and which areas to focus on to improve.
This is a sandbox solution which can be activated per site collection to allow you to easily collect feedback from users into a custom Feedback list.
Whether you are upgrading to SharePoint Online, 2010, 2013 or the latest 2016, this checklist contains everything you need to know for a successful transition.