locked
Trying to create a Javascript FetchXML query, cannot get Operator 'in' to work RRS feed

  • Question

  • Hi all, I am writing a FetchXML query with the operator 'in' but I have messed up my syntax:

        fetchXml += "<condition attribute='statuscode' operator='in'/>";
        fetchXml += "<value>100000007</value>";
        fetchXml += "<value>100000004</value>";

    The above does not return a result. What is the correct syntax for this?

    Wednesday, February 25, 2015 11:38 AM

All replies

  •  fetchXml += "<condition attribute='statuscode' operator='in' >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "<value>100000004</value>";
     fetchXml += "</condition>"


    Regards, Saad


    • Edited by Mohd Saad Wednesday, February 25, 2015 12:01 PM
    Wednesday, February 25, 2015 11:51 AM
  • Thank you for the reply. Unfortunately that doesn't work. I even tried it simply like this:

     fetchXml += "<condition attribute='statuscode' operator='in'/>";
     fetchXml += "<value>100000007</value>"; 

    Which is also not working.

    Wednesday, February 25, 2015 11:58 AM
  •  fetchXml += "<condition attribute='statuscode' operator='in' >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "<value>100000004</value>";
     fetchXml += "</condition>"

    Regards, Saad

    Wednesday, February 25, 2015 12:01 PM
  • It's still not working for me. I am able to get the results returned if I remove the condition. If I add the above condition in, then I do not get any results but an error.
    Wednesday, February 25, 2015 12:31 PM
  • Is the condation inside a filter?

    Is the number of zeros in the value correct?

    fetchXml += " <filter type='and'>";
    fetchXml += "  <condition attribute='statuscode' operator='in' >";
    fetchXml += "   <value>100000007</value>";
    fetchXml += "   <value>100000004</value>";
    fetchXml += "  </condition>";
    fetchXml += " </filter>";

    Wednesday, February 25, 2015 12:56 PM
  • Hi all, I am writing a FetchXML query with the operator 'in' but I have messed up my syntax:

        fetchXml += "<condition attribute='statuscode' operator='in'/>";
        fetchXml += "<value>100000007</value>";
        fetchXml += "<value>100000004</value>";

    The above does not return a result. What is the correct syntax for this?

    create your query with advanced find and after download the XML, much easier.

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Wednesday, February 25, 2015 12:59 PM
  •  fetchXml += "<condition attribute="statuscode" operator="in" >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "</condition>";

     fetchXml += "<condition attribute="statuscode" operator="in" >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "<value>100000004</value>";
     fetchXml += "</condition>";


    Regards, Saad


    • Edited by Mohd Saad Wednesday, February 25, 2015 1:19 PM
    Wednesday, February 25, 2015 1:18 PM