Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

Posted on by

Hi all

I've created a new HTML Web Resource, and populated it as follows:

<html>
<head>
</head>
<body>
	<script src="../ClientGlobalContext.js.aspx" type="text/javascript"></script>
	<div><span>testing</span></div>
</body>
</html>

As you can see, there is nothing in there except the loading of the scripts from ../ClientGlobalContext.js.aspx.

Once this page has loaded, if I press the control key (either of them), I get the following error logged in the console (Chrome below, but I get a similar error in all browsers):

global.ashx?ver=883953442:4024 Uncaught TypeError: Cannot read property 'toString' of undefined
    at Function.Mscrm.Utilities.getResourceValue (global.ashx?ver=883953442:4024)
    at HTMLDocument.Mscrm.GlobalEvents.$6B (global.ashx?ver=883953442:4024)
    at HTMLDocument.b (MicrosoftAjax.js?ver=883953442:2922)
Mscrm.Utilities.getResourceValue @ global.ashx?ver=883953442:4024
Mscrm.GlobalEvents.$6B @ global.ashx?ver=883953442:4024
b @ MicrosoftAjax.js?ver=883953442:2922

It doesn't show to the user (no popup error or anything), but it's annoying for trying to catch my own errors I throw on the page, because I keep intercepting these CRM errors.

Does anyone

  1. have any clue why this error is being thrown?
  2. have any suggestions on a standard or best-practice way of handling CRM Web Resource errors to prevent me catching this error?

This is an on-premise, v8.2 instance. Our dev instance in this case, but it's happening on our live instance, too.

Any help appreciated.

Thanks

*This post is locked for comments

  • Dung Ho Profile Picture
    Dung Ho 40 on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Hello,

    I get exactly the same error when working with a web-resource which is opened as a pop-up from CRM form by the following code.

    window.open(url_of_the_web_resource, "_blank", features, false);

    I also take a look to the function "Mscrm.Utilities.getResourceValue" and see that the "window.top.LOCID_JUMP_TO_RIBBON" is undefined at this moment

    Mscrm.Utilities.getResourceValue = function (value, resourceKey) {
    	if (!Mscrm.InternalUtilities._Script.isNullOrUndefined(value))
    		return value;
    	else {
    		var $v_0 = null;
    		switch (resourceKey) {
    		case "LOCID_JUMP_TO_RIBBON":
    			$v_0 = window.top.LOCID_JUMP_TO_RIBBON.toString();
    			break;
    		case "LOCID_JUMP_TO_RIBBON_CONTROL":
    			$v_0 = window.top.LOCID_JUMP_TO_RIBBON_CONTROL.toString();
    			break
    		}
    		return $v_0
    	}
    }; 

    Do you have any update for this error?

    Thanks.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    I am not sure why this is not working  , just give a try to create another html web resource and add below line in the header , and then add the html in any form of any entity and test once . May be it will helps you to find out the root cause ,  ideally its should work.

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

  • James Profile Picture
    James on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Any suggestions, anyone?

  • James Profile Picture
    James on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Sorry Goutam, I'm not sure what you're asking? I'll try my best: the user logs into CRM, and is presented with a dashboard. There is a link on this dashboard to the page in question. The page is a custom HTML Web Resource.

    Does this help?

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Hello ,

    Seems its depends on where you are showing your custom HTML web resource , can you please tell me where you are displaying the web resource.

  • James Profile Picture
    James on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Thanks Goutam. Unfortunately no luck with either suggestion. Removing the "../" resulted in a 404 for the resource, and moving the script tag to the header still gives the same ctrl-key error.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Ctrl key triggers error in Web Resource when ClientGlobalContext.js.aspx

    Hello ,

    Try with this  , inside header part and removing the "../"

    <html>
    <head>
        <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
    </head>
    <body>    
        <div><span>testing</span></div>
    </body>
    </html>

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans