Xrm.Page.context Methods

1. getAuthenticationHeader: 
Returns the encoded SOAP header necessary to use MSCRM 4.0 Web service calls.
2. getCurrentTheme:
Returns the current Outlook theme chosen by the user.
Returns the LCID value for the base language of the organization.

Returns the unique text value of the organizations name.
Returns an array of key value pairs representing the query string arguments that were passed to the page.
Returns the base server URL. When a user is working offline, the URL is to the local MSCRM Web services.
7. getUserId:
Returns the current user’s SystemUser id.
8. getUserLcid:
Returns the LCID value that the user selected as their preferred language.
Returns an array of strings representing the GUID values of each of the security roles that the user is associated with.
10. isOutlookClient:
Returns a Boolean value indicating if the user is using MSCRM for Outlook client.
11. isOutlookOnline:
Returns a Boolean value indicating whether the user is connected to the MSCRM server while using the MSCRM for Outlook with Offline Access client.
Prepends the organization name to the specified path.

Xrm.Page.data.entity Methods

Sets a function to be called when the record is saved.
Returns a string representing the xml that will be sent to the server when the record is saved.
Returns a string representing the logical name of the entity for the record.
Returns a string representing the GUID id value for the record.
Returns a Boolean value that indicates if any fields in the form have been modified.
Removes a function from the OnSave event hander.
Saves the record. This method has three possible parameters.
8.Xrm.Page.data.entity Methods
Closes the form.
Returns the control object that currently has focus on the form.
Indicates the form context for the record.
Returns the height of the viewport in pixels.
Returns the width of the viewport in pixels.
Causes the ribbon to re-evaluate data that controls what is displayed in it.
Returns the number of tabs in the collection.


The Xrm.Page object provides a hierarchy of objects that can be used to interact
with Microsoft Dynamics CRM 2011 forms in the following ways:

• Show and hide user interface elements.
• Support multiple controls for each attribute.
• Support multiple forms for each entity.
• Manipulate form navigation items.


Xrm.Page.context provides methods that are used to retrieve information that is
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 that are used to manage the user
interface of the form.


The Xrm.Page object includes two shortcut methods that are used to provide
direct access to commonly used controls.


This shortcut provides direct access to the Xrm.Page.data.entity.attributes.get
method. The following example uses the Xrm.Page.getAttribute shortcut method
to get the accountnumber attribute.

var accountnumber = Xrm.Page.getAttribute("accountnumber");


This shortcut provides direct access to the Xrm.Page.ui.controls.get method. The
following example uses the Xrm.Page.getControl to get the accountnumber

var accountnumber = Xrm.Page.getControl("accountnumber");

User-defined Shortcuts

User-defined shortcuts can be created by using JScript. For example, to interact
with the controls found in a specific section of a form, a shortcut variable can be
created to enable easy access to those controls.

var myControls =

SOURCE : mscrm.com