Javascript functions of Xrm.Page.context

Javascript plays very crucial part in MS CRM projects. While writing down any javascript, we need to read the CRM context for few details like organization name, client url. Below javascript snippets gives details about each function of context.

1. Xrm.Page.context.client.getClient();

this code snippet will returns the results about client details. whether Web, Outlook or Mobile.

2. Xrm.Page.context.client.getClientState();

this code will return the client state. possible return values are; For web client  it will returns always "Online".  For outlook and mobile it can be either "Online" or "Offline"

3. Xrm.Page.context.client.getFormFactor();

this getFormFactor() will returns integer value which will indicate what kind of devices user is using.

0  - Unknown
1 - Desktop
2 - Tablet
3 - Phone

4. Xrm.Page.context.getClientUrl();

this method will returns the base url of current application.

5. Xrm.Page.context.getCurrentTheme();

this method will returns the current Microsoft Office Outlook theme using by the user.this function mostly userful for client type Outlook. for web application this function will returns "default".

6. Xrm.Page.context.getIsAutoSaveEnabled();

this function will return boolean variable based on Auto Save function is enabled or not.

7. Xrm.Page.context.getOrgLcid();

this will returns the base language of the organization. For english its values is 1033.

8. Xrm.Page.context.getOrgUniqueName();

this function will returns the current organization name.

9. Xrm.Page.context.getQueryStringParameters();

this function will returns an object which contains all the query string parameters of the form contains.

10. Xrm.Page.context.getTimeZoneOffsetMinutes();

this function will returns the minutes difference between local time to UTC time.

11. Xrm.Page.context.getUserId();

this function will returns the guid of an user who logged into the application.

12. Xrm.Page.context.getUserLcid();

this function will returns the base language user has been selected.

13. Xrm.Page.context.getUserName();

this function will returns the name of the user who logged into the application.

14. Xrm.Page.context.getUserRoles();

this function will returns the array of roles assigned to the current user.




You may like below posts

Improving MS CRM Performance

Performance Center in MS CRM 2013

date and time field behavior in MS CRM

Upsert in MSCRM

Locking mechanism in MS CRM

Ticker Symbol Field in MS CRM

Themes in MS CRM

Enable Tracing in MS CRM

Calculated Field in Dynamics CRM 2015

IME Mode in MS CRM










No comments:

Post a Comment

Featured Post

Improving MS CRM Performance

Performance on MS CRM is always a crucial thing and we may follow different ways to achieve the performance thing. Below is the one more a...