The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

Check your JavaScript code to prepare for your upgrade

Check your JavaScript code to prepare for your upgrade

  • Comments 1

Microsoft Dynamics CRM is changing. To keep up with these changes so that you can take advantage of new features you need to check that any JavaScript code you are using is ready for an upgrade.

Download the Microsoft Dynamics CRM 2013 Custom Code Validation Tool.

Why do I need to check my JavaScript?

The JavaScript code in your deployment was written and tested to work based on conditions at the time. Things have changed and you need to make sure you are ready.

What has changed?

Several things have changed or will change soon.

For people using Microsoft Dynamics CRM 2011 on-premises who still haven’t applied the December 2012 Service Update:

  • We support more browsers. Before the Microsoft Dynamics CRM 2011 December 2012 Service Update, Microsoft CRM only supported Internet Explorer. But now it supports many other browsers. Browsers are different. The code someone wrote just for Internet Explorer might not work using other browsers. If you are going to support other browsers, you need to verify that your code will work for those browsers.
  • We changed our pages. The Document Object Model (DOM) of the pages in our application has changed and will continue to change. We have always told people that we don’t support direct interaction with our DOM because we have to change it from time to time to improve the application. You should make sure that your code doesn’t do this or it could break during an upgrade.
  • We have changed our internal code. We need to change our internal code to make a better application. Any code that a developer created using internal methods they discovered will probably break when our code changes.

For people looking to upgrade to Microsoft Dynamics CRM 2013, these changes and others were announced on this page: What’s Changing in the Next Major Release.

  • We deprecated some of our old web service endpoints. When Microsoft Dynamics CRM 2011 was released we announced that using the web service endpoint from CRM 4.0 would go away in the next version. Everyone needs to convert their code to use the new CRM 2011 endpoints, even when using JavaScript. Any code still using those CRM 4.0 (2007) endpoints will stop working when you upgrade unless you convert the code to use the new web service endpoints.
  • We deprecated our old public form object model. When Microsoft Dynamics CRM 2011 was released we introduced a new public Xrm.Page object model for form scripting and announced that the old form object model would continue to work until the next version. When you upgrade to CRM 2013 the old form object model will not be there anymore.

How can I check my code?

The support team did some research on common issues that could break and prepared a Microsoft Dynamics CRM 2013 Custom Code Validation Tool. Download this tool and extract the contents. Within the contents you will find instructions about how to install and use the tool.

If you have downloaded this tool and used it before, you will see that it now includes additional logic to check for changes related to upgrading to Microsoft Dynamics CRM 2013.

The tool is a managed solution that you install and it will examine your web resources and show you where there might be some problem areas.

Note: Not every issue that is returned by this tool represents a problem. This tool looks for certain characters in the code and highlights those that look like they may be a problem. But there are many times where it is perfectly fine to use certain code in one situation if you have applied the appropriate code for a different situation.

Some examples:

  • Your JavaScript code may support an HTML web resource and in that case it is perfectly fine to interact with the DOM of the web resource.
  • JavaScript libraries that are written for multiple browsers typically test whether a particular feature exists in a browser before choosing what feature to use. Code that is part of that test is expected to fail if the feature isn’t available so that an alternative code path can be used.
  • The code might be commented out so it won’t execute.

This tool can’t find every possible problem. You still need to do testing as part of your upgrade process to ensure that everything works. Use this tool to get a sense of what kind of issues exist and identify which web resources need the most attention.

How can I fix my code?

If the code is part of a solution created by someone else which you installed, for example maybe you downloaded it from the marketplace, then you should contact the people who created the solution. They may have already created an updated version that can work with the newer versions of Microsoft CRM.

If your code was applied by a partner who helped you with your implementation, reach out to them and discuss the results you get when you run using the Custom Code Validation tool.

If the code is part of a customization that your organization created, you really need to understand what your code is doing before you can determine if it needs to be fixed and how to fix it. You should review the documentation created as part of your development process. A JavaScript developer who understands how to program using the Microsoft Dynamics CRM APIs together with a business analyst who understands the business requirements should be able to use the custom code validation tool and generate a list of web resources that need to be changed.

To summarize the types of changes that need to be made:

Issue TypeMethod to address it

Using CRM 4.0 (2007) endpoints

Using CRM 4.0 form object model (crmform)

Code is not ready for browsers other than Internet Explorer

Code uses unsupported methods

If there isn't a supported way to achieve your requirement you will need to consider dropping functionality it provides or  finding another way to achieve it.

Here are some links that can provide tips that may be useful when fixing your code:

 

Do I need to fix everything?

It really depends on what version you plan to upgrade to.

  • If you are using CRM Online you need to address all the changes – especially the removal of the CRM 4.0 web service endpoints and form object model.
  • If you have a Microsoft CRM 2011 on premise deployment and want to install update rollup 12 or later - you don’t have to apply changes to the old web service endpoints or the form object model. But you really should get started because you will eventually need to do this before you can upgrade to CRM 2013. At a minimum, make sure you aren’t adding new code that uses these deprecated features.
Page 1 of 1 (1 items)
Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post