Updating JavaScript code in Dynamics CRM Made Easy for Developers

Why do we need JavaScript in Dynamics CRM?

It helps to implement custom logic by using client-side scripting. We use JavaScript to implement custom logic. For example, getting data from another entity based on a field selection or applying field validation.

Why do we need to update JavaScript?

The updates depend on the requirements. If the requirements change, we need to update our JavaScript code.

How can we change the existing Web Resource JavaScript code?

To update the code, you don’t need to start from scratch. Chances are that you have put in a lot of time and resources into creating the Web Resources for the forms in your current CRM system and would like to leverage those investments.

We have lots of different tools in XrmToolBox which are useful for performing the update.

Let’s take a look at some in this blog.

Dynamics 365 V9 JavaScript Validator (by Michel Gueli)

https://www.xrmtoolbox.com/plugins/XrmToolBox.Dynamics365V9JavaScriptValidator/

This tool is used for validating all your scripts and provides detailed information on what has to be updated and shows all errors and warnings in your script.

Here are the steps to use this tool:

  • To get the list you just need to go to XrmToolBox and connect to your Organization.
  • If you want to see the warnings from all solutions select all solutions or you can select a particular solution and click on retrieve web resources.
  • Now click on scan all or select some web resource and click scan selected.
  • Now you can see all the detailed warnings in the log.
  • Below is a screenshot that shows all the counts and warnings in your scripts.

Dynamics 365 V9 JavaScript Validator - AhaApps

Script Finder

https://www.xrmtoolbox.com/plugins/MsCrmTools.ScriptsFinder/

This tool is used to list and update the form events for passing the executionContext, parameters and enable/disable the event in the form.

Below are the steps to use this tool.

  • To get the list you just need to go to XrmToolBox and connect to your Organization.
  • If you want to see the Form Events, click on Find Script Usage and select an option for all entities or for entities in the selected solution and click ok to retrieve all events.
  • You can also add filters by clicking on Show Filters.
  • Now select some event and you will be able to see the updated properties at the bottom.
  • In the update Properties tab, you will be able to pass the executionContext, parameters and enable/disable the event in the form.
  • Click on save the properties will be updated in the CRM System.

And here is a screenshot of how the script finder looks.

Script Finder - AhaApps

JavaScript Migrator

https://d365geekstertips.wixsite.com/home/post/xrmtoolbox-javascrip-migrator-plugin

This tool is used to migrate your JavaScript, activate execution context for form and execution context for the ribbon. As shown in the below picture your code will be automatically generated when you select the file and if you click on update it will update in your CRM system with the latest code.

  • It helps you calculate the time (in hours) that the migration might take when it’s done manually.
  • It identifies the block of code that needs to be reviewed.
  • It analyzes the script and automates the following:
  • Highlighting/Replacing deprecated client APIs by the corresponding ones based on Microsoft recommendations.
  • Migrating all the functions and their contents.
  • It verifies the result and selects which scripts you wish to update.

Below are the steps to use this tool:

  • Install JavaScript Migrator plugin from XrmToolBox plugins.
  • Retrieve the web resources from a specific solution you already prepared.
  • After choosing the solution, the tool will gather from the CRM, all the needed information: A list of web resources, Entities metadata, Ribbon Events, and Form Events.
  • To update the web resource and its related events, you can choose between updating the elements directly, or adding them to a queue to be pushed later, after you have analyzed multiple scripts.
  • After adding multiple scripts to the queue, you can update all the web resources, with options you have chosen, by clicking on the update button

Here is a screenshot of how the JavaScript Migrator looks.

Migrator - AhaApps

You can also analyze all the web resources and get a valuation of the work amount that needs to be done (button Analyze/Export). The result can be extracted in an Excel file (the obtained estimations are in hours).

Developers can save a lot of time using these tools.

Dynamics CRM is revolutionary and the way it has changed the way businesses, industries operate is remarkable. We would love to tell you more about it, so, connect with us soon.

Download our eBook “15 Questions to Identify the Gaps in Your CRM”

2 thoughts on “Updating JavaScript code in Dynamics CRM Made Easy for Developers”

  1. It’s XrmToolBox, not XRM Toolbox…

    Anyway, you just forgot one of the most important tool : Webresources Manager that let’s you edit your webresources (Javascript included)

    1. Yes, you are right we have changed it. Webresources Manager is the most useful tool which we’ve missed mentioning in the blog. Thank you

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Show Buttons
Hide Buttons