GetGlobalContext function and ClientGlobalContext.js.aspx (client-side reference)
Updated: November 29, 2016
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
Use the GetGlobalContext function when programming with web resources to gain access to context information. To get the GetGlobalContext function in your HTML web resource, include a reference to ClientGlobalContext.js.aspx.
The GetGlobalContext function returns the same context object found in the Xrm.Page.context.
When you need context information outside a form, include a reference to the ClientGlobalContext.js.aspx page in an HTML web resource.
The following example shows a function designed to return a context object when used in either a form script or a script used with an HTML web resource.
You can use the GetGlobalContext function when you include a reference to the ClientGlobalContext.js.aspx page located at the root of the web resources directory.
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.
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright