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.
3.getOrgLcid:
Returns the LCID value for the base language of the organization.

4.getOrgUniqueName:
Returns the unique text value of the organizations name.
5.getQueryStringParameters:
Returns an array of key value pairs representing the query string arguments that were passed to the page.
6.getServerUrl:
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.
9.getUserRoles:
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.
12.prependOrgName
Prepends the organization name to the specified path.


Xrm.Page.data.entity Methods

1.addOnSave
Sets a function to be called when the record is saved.
2.getDataXml
Returns a string representing the xml that will be sent to the server when the record is saved.
3.getEntityName
Returns a string representing the logical name of the entity for the record.
4.getId
Returns a string representing the GUID id value for the record.
5.getIsDirty
Returns a Boolean value that indicates if any fields in the form have been modified.
6.removeOnSave
Removes a function from the OnSave event hander.
7.save
Saves the record. This method has three possible parameters.
8.Xrm.Page.data.entity Methods
9.close
Closes the form.
10.getCurrentControl
Returns the control object that currently has focus on the form.
11.getFormType
Indicates the form context for the record.
12.getViewPortHeight
Returns the height of the viewport in pixels.
13.getViewPortWidth
Returns the width of the viewport in pixels.
14.refreshRibbon
Causes the ribbon to re-evaluate data that controls what is displayed in it.
Returns the number of tabs in the collection.



Xrm.Page

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

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.entity
Xrm.Page.data provides an entity object that provides collections and methods to
manage data within the entity form.

Xrm.Page.ui
Xrm.Page.ui provides collections and methods that are used to manage the user
interface of the form.


Shortcuts

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

Xrm.Page.getAttribute

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");

Xrm.Page.getControl

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
control.

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 =
Xrm.Page.ui.tabs.get(2).sections.get(0).controls.get();





SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012