3

In sample example in SDK and at different places on internet Clientglobalcontext.js.aspx file is mentioned, if I do not include it in my html web resource, it throws exception, but if I include file like,

<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

Then only rest endpoint API is working. Now, I am not able to locate this file anywhere. What is exact use of this file? How to locate it?

Pranit Kothari
  • 9,721
  • 10
  • 61
  • 137

1 Answers1

3

The purpose of the ClientGlobalContext.js.aspx is to provide the GetGlobalContext function.

It's all explained inside MSDN:

GetGlobalContext function and ClientGlobalContext.js.aspx (client-side reference)

The GetGlobalContext function returns the same context object found in the Xrm.Page.context.

The file is generated server-side, practically the ClientGlobalContext.js.aspx push a JavaScript file to the client when it is included with the <script> tag syntax.

Guido Preite
  • 14,905
  • 4
  • 36
  • 65
  • This is not working in CRM 2016 online instance. Is there any other way to do it ? – Anish Jul 21 '16 at 10:41
  • it works on CRM 2016 Online, I just used it few days ago – Guido Preite Jul 21 '16 at 14:07
  • Can you please help me how it works in html which is opened in separately new window. Please answer at http://stackoverflow.com/questions/38502033/xrm-context-in-html-webreource-in-mscrm-2016?noredirect=1#comment64430112_38502033 – Anish Jul 22 '16 at 05:08