Issue while using SDK.MetaData.js in Chrome in CRM 2013.

Recently was writing a jscript function to populate optionset value using SDK.MetaData.js helper class.

It was working fine in IE, however I was getting error in Chrome.

It turned out the following condition was always evaluating as true

And as selectSingleNode is not supported in Chrome we were getting error.

Added the following condition fixed the issue


if (typeof( != ‘undefined’) {


var xpe = new XPathEvaluator();

var xPathNode = xpe.evaluate(xpathExpr, node, _NSResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

return (xPathNode != null) ? xPathNode.singleNodeValue : null;




Hope it helps..

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

One thought on “Issue while using SDK.MetaData.js in Chrome in CRM 2013.”

  1. Hi,

    thank you for your post. I’m looking for a solution to a similar problem. But I’m not sure if I understand your approach 100%.

    typeof( != “undefined” is true when the browser is Chrome, right? If that’s the case you use the out-of-the-box else-block.

    If I do that I get “Uncaught NotSupportedError: Failed to execute ‘evaluate’ on ‘XPathEvaluator’: The node provided us null.” although the node is of course not null :/

    I’m a little lost on this one since I feel like neither of the two options in the function works in Chrome. Would you mind giving me a pointer to how exactly the structure is after your change?


Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.