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)

IE workaround for XPathEvaluator

(0) ShareShare
ReportReport
Posted on by

Hi, I have encountered a problem where I am trying to retrieve the option set from the forms account to get the selected option text and put in a text field on the quote form. The problem is that while using the SDK.Metadata the function XPathEvaluator is coming up as undefined as I am using IE, does anyone know a workaround?

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    You can use selectNode() and selectSingleNode() on the DOM Document object instead for IE browser to parse the xml.

  • Community Member Profile Picture
    on at

    Hi Chitra

    This is all new to me, could you perhaps give some example code of how this is done?

  • Royal King Profile Picture
    27,686 on at

    here is sample code that may help you to get started

    var resultRes = httpReq.responseXML;

    var errorCount = resultRes .selectNodes('//error').length;

    alert("After the result XML "+resultRes .toString() + " ::::");

    var username = resultRes .selectSingleNode("//q1:new_jabberusername").nodeTypedValue;

    var pass = resultRes .selectSingleNode("//q1:new_jabberpassword").nodeTypedValue;

  • Community Member Profile Picture
    on at

    Hi,

    Thank you, unfortunately this has gone completely over my head, I am using the SDK.Metadata supplied with by Microsoft, the following code is where the function is crashing out

      else {

        var xpe = new XPathEvaluator();

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

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

       }

  • Royal King Profile Picture
    27,686 on at

    I tried running sdk Meta data script in my org and i did not see this error message.

    Anyway try with below code and should work without any error

    if (typeof (node.selectSingleNode) != "undefined") {

      return node.selectSingleNode(xpathExpr);

     }

     if (XPathEvaluator) {

         var xpe = new XPathEvaluator();

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

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

     }

     else {

         return node.selectSingleNode(xpathExpr);

     }

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