web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Replacing GetGlobalContext() with Xrm.Page.Context in JScript?

(0) ShareShare
ReportReport
Posted on by

I have JScript which calls GetGlobalContext() function. During a code review process, I is pointed that Xrm.Page.Context should be used instead. I reviewed and found that GetGlobalContext should be used when call is made outside the form. Kindly suggest should I replace GetGlobalContext() with Xrm.Page.Context in my JScript? Also, clarify, whether JScript is considered outside to a form or not in CRM.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rajkumar Rajaraman Profile Picture
    on at

    Hi Siddharth,

    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.

    Refer the following msdn link. It explains deeply.

    msdn.microsoft.com/.../gg328541.aspx

    Hope this helps.

    Regards,

    R.Rajkumar

    "Please mark my answer as verified if you found it helpful"

  • Community Member Profile Picture
    on at

    Can you also please tell me whether JScript which I have created separately will be considered outside a form?

  • Verified answer
    Royal King Profile Picture
    27,686 on at

    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.

    It does not matter whether you use GetGlobalContext  or Xrm.Page.context it refers the same object.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans