GetGlobalContext function and ClientGlobalContext.js.aspx (Client API reference)
Use the GetGlobalContext function when programming with web resources to gain access to the global context information such as the information specific to the client, organization or user for your model-driven apps instance.
To get access to the GetGlobalContext function in your HTML web resource, include a reference to ClientGlobalContext.js.aspx.
Including a reference to ClientGlobalContext.js.aspx does not make the Xrm object available in HTML web resources. Therefore, scripts containing
Xrm.* methods aren’t supported in HTML web resources.
parent.Xrm.* will work if the HTML web resource is loaded in a form container. However, for other places, such as loading an HTML web resource as part of the SiteMap,
parent.Xrm.* also won’t work.
The GetGlobalContext function returns the same context object as returned by the Xrm.Utility.getGlobalContext method, which implies that the context object will have the same properties and methods as available for Xrm.Utility.getGlobalContext. More information: Xrm.Utility.getGlobalContext
You must include a reference to the ClientGlobalContext.js.aspx page located at the root of the web resources directory to be able to use the GetGlobalContext function.
If you are not using backslash characters in HTML web resource names to simulate a folder structure, you can include this script by directly referring to it. For example:
Using a relative path including the root WebResources folder, for example, /WebResources/ClientGlobalContext.js.aspx, is not recommended because it can cause the page to lose organization context in a multi-tenant environment.