Export (0) Print
Expand All

Upgrade Scripts to Microsoft Dynamics CRM 2011

[Applies to: Microsoft Dynamics CRM 2011]

When your Microsoft Dynamics CRM 4.0 organization is upgraded, your script customizations will be upgraded to adapt to new features added in Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online. If you have used only supported script methods you should expect that the full functionality of your scripts should remain intact after the upgrade.

Scripting provides the greatest opportunity to perform unsupported customizations. If requirements have demanded that you use unsupported scripting methods, you should expect that they may not work after your organization is upgraded. You must allocate time and resources to test whether they continue to work after you upgrade and potentially re-implement your customizations to adapt to breaking changes. You should review your customizations and identify whether you can now achieve equivalent results using new capabilities introduced in Microsoft Dynamics CRM 2011.

This topic provides a general overview of what you should expect for your scripts when your organization is upgraded and provide a description of new capabilities that address requirements that could not typically be achieved by using supported script customizations in Microsoft Dynamics CRM 4.0. This topic cannot provide detailed information about how to migrate unsupported script customizations to a working or supported state for Microsoft Dynamics CRM 2011. If you require assistance, contact the creator of the unsupported customizations, seek assistance from community resources, or contact technical support.

In This Topic

Upgrading Scripts that Use crmForm

Microsoft Dynamics CRM 4.0 used the crmForm object to provide access to form fields. The crmForm is deprecated in Microsoft Dynamics CRM 2011. Scripts using crmForm will continue to work in Microsoft Dynamics CRM 2011 to support backward compatibility for Internet Explorer only, but many Microsoft Dynamics CRM 2011 form scripting features cannot be achieved by using crmForm.

To use crmForm with Microsoft Dynamics CRM 2011 Update Rollup 12 and Microsoft Dynamics CRM December 2012 Service Update you must make sure the customization system setting Include HTC support in Microsoft Dynamics CRM forms is selected. For more information, see HTC Support for Internet Explorer in CRM Forms.

In the next major release, support for crmForm will end and the object will no longer be available. You should plan to migrate your scripts from using crmForm to Xrm.Page.

noteNote
If you upgrade scripts from Microsoft Dynamics CRM 4.0 and then prepare or receive an updated solution that contains scripts that are designed to use Xrm.Page and a different naming convention, make sure that you remove the event handlers created during upgrade. Otherwise you could have two event handlers performing the same operations.

ISVs should prepare to help their customers remove the event handlers and JScript libraries that represent the upgraded scripts from Microsoft Dynamics CRM 4.0. Organizations who have added customized scripts in addition to scripts provided by an ISV to their Microsoft Dynamics CRM 4.0 deployment should prepare to separate their custom script logic from the script logic provided by an ISV.

Using JScript Libraries

In Microsoft Dynamics CRM 4.0 form event scripts were embedded within a form. Each event allowed you to add script code to handle it and there was no supported method to re-use code by defining functions or loading JScript library files together with the form.

Microsoft Dynamics CRM 2011 provides for JScript libraries to be defined as web resources and there is a much more robust event handler pipeline so that multiple event handlers can be associated with any given event. When your organization is upgraded a new JScript library is created for each form. For example, all the scripts for the main account form will be added as functions to a JScript library named account_main.js. The code you have specified for each event is converted into a function and that function is registered as an event handler for the event.

After your organization is upgraded you may want to review the JScript libraries and refactor them so that you can take advantage of any opportunities for code re-use in addition to converting them over to use Xrm.Page methods.

You also can associate JScript libraries to the form without explicitly associating them to a form event. This enables for your event handler functions to use utility functions in these shared libraries.

New Capabilities that Replace Unsupported Methods

The following table highlights new capabilities available using the Xrm.Page that were only possible using unsupported methods in Microsoft Dynamics CRM 4.0. 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:

 

Goal Xrm.Page method

Manipulate views presented for a lookup field.

Xrm.Page.ui.addCustomView

Xrm.Page.ui.setDefaultView

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 within 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 is not available from any of the rule elements provided you can create a <CustomRule> (RibbonDiffXml) that will call a function in a JScript library. For more information, see Define Ribbon Display Rules.

ImportantImportant
Update Rollup 12 and December 2012 Service Update support browsers other than Internet Explorer. With this release it is expected that unsupported code will stop working or throw errors. See the following blog posts for more information:

New URL for Addressable Forms and Views

As described in URL Addressable Forms and Views the format of URLs used in Microsoft Dynamics CRM 2011 has changed. To open a new account from in Microsoft Dynamics CRM 4.0 you would use the relative URL/SFA/accts/edit.aspx. In Microsoft Dynamics CRM 2011 you will use /main.aspx?etn=account&pagetype=entityrecord. Your Microsoft Dynamics CRM 4.0 URLs will continue to work in Microsoft Dynamics CRM 2011 but you should plan to migrate them over to use the main.aspx page for future upgrades.

Using Web Services

Any Microsoft Dynamics CRM 4.0 web service calls you made in scripts should continue to work using the 2007 endpoint. For Microsoft Dynamics CRM 2011 the REST endpoint is much easier to use for basic operations to create, read, update, and retrieve records in script. Although the Xrm.Page.context.getAuthenticationHeader function exists, you should not modify your scripts to use it. Scripts can continue to use the global getAuthenticationHeader function. The Xrm.Page.context.getAuthenticationHeader function is deprecated.

Upgrading ISV.Config Configurations

Custom <Button> and <MenuItem> elements in the ISV.Config for Microsoft Dynamics CRM 4.0 allowed for specifying scripts for actions when the controls are used. During upgrade these scripts are added to JScript libraries as functions and are migrated to use equivalent Ribbon controls.

Custom <NavBarItem> elements are upgraded so that the form navigations are included in the FormXml in Microsoft Dynamics CRM 2011.

With the capabilities to define custom UI elements removed from ISV.Config, the only remaining functional items remaining in ISV.Config are to specify configurations of the <ServiceManagement> element. For more information, see Service Calendar Appearance Configuration.

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft