The Xrm.Page object provides a hierarchy of objects that can be used to interact with Microsoft Dynamics CRM 2011 forms.
|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, but certain Microsoft Dynamics CRM 2011 features, such as the ability to navigate to different forms for an entity, the ability to access a field displayed more than one time on a form, or the ability to hide form elements cannot be achieved using crmForm.|
The Xrm.Page object serves as a namespace object to consolidate three properties on the form:
- Xrm.Page.context provides methods to retrieve information specific to an organization, a user, or parameters that were passed to the form in a query string.
- Xrm.Page.data provides an entity object that provides collections and methods to manage data within the entity form.
- Xrm.Page.ui provides collections and methods to manage the user interface of the form.
|The Xrm.Page object is available to JScript functions for form events and in JScript functions called by ribbon commands. However, Xrm.Page.data and Xrm.Page.ui only exist in the context of an entity form. You can use the functions available within Xrm.Page.context when writing scripts to be available for ribbon commands that do not occur within an entity form ribbon.|
Two shortcut methods are provided to get direct access to commonly used controls.
- Provides direct access to the Xrm.Page.data.entity.attributes.get method.
- Provides direct access to the Xrm.Page.ui.controls.get method.
You can define your own shortcuts using JScript. For example, if you are only concerned with controls found within a specific section of a form, you may create a shortcut variable to allow easy access to those controls:
var contosoControls = Xrm.Page.ui.tabs.get(2).sections.get(0).controls.get();
Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.