Upgrade scripts to Microsoft Dynamics CRM 2013


Applies To: Dynamics CRM 2013

If your scripts are using only the supported Xrm.Page and Xrm.Utility APIs provided by the most recent releases of Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online you should find that your scripts will continue to work after you upgrade.

Before your upgrade you should make sure that none of your scripts use capabilities that were deprecated in Microsoft Dynamics CRM 2011 and have been removed in Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online. If your scripts still include references to these objects your scripts will fail after you upgrade. More information: Deprecated features removed in this release

If your organization did not apply Microsoft Dynamics CRM 2011 Update Rollup 12 or a later update, or doesn’t use the Microsoft Dynamics CRM December 2012 Service Update you may not have not tested or modified your scripts to ensure that they work with browsers other than Internet Explorer. After you upgrade, people will be able to use browsers described in Supported web browsers and mobile devices. There are some differences in the features available when using JavaScript in different browsers that could cause your scripts to break. You need to test your scripts using different browsers and apply any changes. More information: Write JavaScript for multiple browsers

If your organization or solution contains scripts that use unsupported methods, you may find that they won’t work in this release. Test your scripts and determine if they still work. If they don’t work, evaluate if the functionality they provide can be achieved using supported methods, if the functionality can be removed, or if you can find some other way to achieve this functionality in the upgraded application. More information: New capabilities to replace unsupported methods

The Microsoft Dynamics CRM 2013 Custom Code Validation Tool is a managed solution that you can install and run to inspect your web resources for issues that might cause your scripts to break with this release. This is a valuable resource to assist in locating potential problems. It can’t find every possible issue and it will raise some false positives. You still need to understand what the code is doing and test it.

In This Topic

Deprecated features removed in this release

New capabilities to replace unsupported methods

Deprecated features removed in this release

The following features frequently used in form scripts were deprecated in Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online and are not available in Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online:

  • Microsoft Dynamics CRM 4.0 object model
    The objects described in the Microsoft Dynamics CRM 4.0 SDK topics Form Programming Reference and Global Scripting Reference are no longer available. Each global function or variable has been replaced with a new API. See Client-side context (client-side reference) for the APIs that replace them. Any code that references the crmForm object must be replaced with equivalent APIs that are included in the Xrm.Page object. More information: Client-side programming reference and Form scripting quick reference

  • Microsoft Dynamics CRM 4.0 (2007) web service endpoint
    The Microsoft Dynamics CRM 4.0 SDK included some sample code in Scripting Sample Code that described how to access data using the 2007 web service endpoint using JavaScript. However, since Microsoft Dynamics CRM 2011 was released, the preferred methods to access web services have been to use the OData (REST) endpoint and the Modern App SOAP endpoint. Because the 2007 endpoint is removed in this release, you must update your code to use either the OData or Modern App SOAP endpoint. More information: Use web service data in web resources (OData and Modern app SOAP endpoint)

  • Xrm.Page.context.getServerUrl and Xrm.Page.context.AuthenticationHeader
    Xrm.Page.context.getServerUrl was deprecated in favor of Xrm.Page.context.getClientUrl to provide a consistent method to get the organization URL.

    Xrm.Page.context.AuthenticationHeader was never needed for the OData (REST) endpoint or the Modern App SOAP endpoint. It was only provided to provide an alternative to the Microsoft Dynamics CRM 4.0 GenerateAuthenticationHeader Function. Now that the 2007 endpoint is removed there is no need for it.

New capabilities to replace unsupported methods

The following table highlights new capabilities available using the Xrm.Page that were only possible using unsupported methods in earlier versions. If you have used unsupported methods to achieve these results, you should plan to changes your scripts so that they use these supported methods after you upgrade.


Xrm.Page method

Show custom tooltips.

Edit the attribute description. The attribute description text will appear as a tooltip. No code required.

Show form and control notifications.

Use Xrm.Page.ui control.setNotification to set a notification message on a control and prevent save of the record until Xrm.Page.ui control.clearNotification is called to clear it.

Use Xrm.Page.ui control.setFormNotification to set a form level notification and use Xrm.Page.ui.clearFormNotification to clear it.

Manipulate views presented for a lookup field.

Use the new PreSearch event just before the search dialog opens when setting a lookup value. This event doesn’t have a user interface to set an event handler in the application, it can only be set using the Xrm.Page.ui control.addPreSearch method. Use this event with the addCustomFilter, addCustomView and setDefaultView methods to control the views opened when people search for a record to set as the value of a lookup field.

Specify whether a date control should show the time portion of the date.

Use Xrm.Page.ui control.setShowTime.

Change the labels that appear in the form.

Use the setLabel method for tabs, sections, controls and navigation items.

Hide form elements.

Use the setVisible method for tabs, sections, controls and navigation items.

You can use the tab.setDisplayState method to expand or collapse a tab.

Set focus on a form tab or navigation area.

Use the setFocus method available for tab, control, and navigation items.

Set the required level for controls.

Use the attribute.setRequiredLevel method.

Add additional functions to an event using code.

Use the attribute.addOnChange or entity.addOnSave methods.

Hiding menu items or buttons.

The only capability in Xrm.Page to affect the ribbon is to use the refreshRibbon method. To hide or disable controls present in the ribbon you must configure <EnableRule> (RibbonDiffXml) and <DisplayRule> (RibbonDiffXml) within <CommandDefinition> (RibbonDiffXml) elements.

These rules allow for a number of data-driven rules you can apply to hide or disable controls for a form. If your logic requires data that isn’t available from any of the rule elements provided, you can create a <CustomRule> (RibbonDiffXml) that calls a function in a JScript library. More information: Define ribbon display rules

See Also

Upgrade your code from Microsoft Dynamics CRM 2011 to Microsoft Dynamics CRM 2013
Upgrade plug-ins and custom workflow activities
Check your JavaScript code to prepare for your upgrade
Resolve Breaking Script Issues When Upgrading Microsoft Dynamics CRM
Microsoft Dynamics CRM 2011 Custom Code Validation Tool Released
Upgrade your customizations from Microsoft Dynamics CRM 2011
Use the Xrm.Page object model