Client API Xrm object

The Xrm object is globally available to use in your code without having to use the execution context in Client API.

Xrm object model

The following illustration displays the Xrm object model:

Xrm Object Model.

Here is the information about each of the namespaces in the Xrm object:

Namespace Description
Xrm.Device Provides methods to use native device capabilities.
Xrm.Encoding Provides methods to encode strings.
Xrm.Navigation Provides methods for navigating forms and items in model-driven apps.
Xrm.Panel Provides a method to display a web page in the side pane of model-driven apps form.
Xrm.Utility Provides a container for useful methods.
Xrm.WebApi Provides methods to use Web API to create and manage records and execute Web API actions and functions.

Xrm.WebApi.offline: Provides methods to create and manage records in the model-driven apps in mobile clients while working in offline mode.

Xrm.WebApi.online: Provides methods to use Web API to create and manage records and execute Web API actions and functions when connected to the server.

Client API global context

Use the Xrm.Utility.getGlobalContext method in forms to retrieve information specific to an organization, a user, or the client where script is run without going through the form execution context. This is a change from previous versions where you had to use the form context to retrieve global context by using Xrm.Page.context.

Note

Xrm.Page.context is deprecated in the current release, and you should now use the new Xrm.Utility.getGlobalContext method to get global context in your code targeting version 9.0 or later.

To access the global context information in a standalone HTML Web resource, you should include a reference to ClientGlobalContext.js.aspx in the web resource, and then use the GetGlobalContext function. More information: GetGlobalContext function and ClientGlobalContext.js.aspx

Understand the Client API object model
Deprecated client APIs