Friday 13 April 2012

CRM 2011 Javascript

Xrm.Page
Xrm.Page is the new crmForm, or if you are just starting: Xrm.Page is the JavaScript
namespace where you can access CRM form UI Elements and fields.
Returns an attribute on the form:
Xrm.Page.getAttribute("field");

Returns a control on the form:
Xrm.Page.getControl("field");
                       
Xrm.Page.ui
This namespace contains functions for manipulation of the form UI. This includes tabs, sections and fields.
Returns type of form like update, create, etc.:
Xrm.Page.ui.getFormType();

Returns width of view in pixels:
Xrm.Page.ui.getViewPortWidth();

Returns current active control:
Xrm.Page.ui.getCurrentControl();

Returns a control on the form:
Xrm.Page.ui.controls.get("field");

Returns the property of the tab:
Xrm.Page.ui.tabs.get("tabName");
                        
Xrm.Page.context
The context object provides methods to retrieve information specific to an organization, a user, or parameters that were passed to the form in a query string.
Return the GUID of the current user:
Xrm.Page.context.getUserId();

Returns the current user role/roles.:
Xrm.Page.context.getUserRoles();

Returns whether a user is in the Outlook client.:
Xrm.Page.context.isOutlookClient();

To check the outlook client is online:
Xrm.Page.context.isOutlookOnline();

Returns the unique org name for the current active organization:
Xrm.Page.context.getOrgUniqueName();

Returns the url of the server.:
Xrm.Page.context.getServerUrl();

Returns the authentication header required to make SOAP calls.:
Xrm.Page.context.getAuthenticationHeader(); 

Returns the current Outlook theme chosen by the user
Xrm.Page.context.getCurrentTheme();

Returns the LCID value for the base language of the
Organization
Xrm.Page.context.getOrgLcid();

Returns an array of key value pairs representing the query
string arguments that were passed to the page
Xrm.Page.context.getQueryStringParameters();

Returns the LCID value that the user selected as their
preferred language
Xrm.Page.context.getUserLcid();

Prepends the organization name to the specified path
Xrm.Page.context.prependOrgName();
Xrm.Page.data.entity
Provides methods to retrieve information specific to the record displayed on the page, the save method and a collection of all the attributes included in the form
Returns the current entity's GUID:
Xrm.Page.data.entity.getId();

Returns the current entities schema/logical name.:
Xrm.Page.data.entity.getEntityName();

Forces a manual save of the entity:
Xrm.Page.data.entity.save();

Determines whether or not the form is dirty,
i.e. if there are any unsaved changes.:
Xrm.Page.data.entity.getIsDirty();

Returns the property of the tab:
Xrm.Page.ui.tabs.get("tabName");
                        

No comments:

Post a Comment