简体   繁体   中英

How to pass the Null Value in Javascript in Dynamics CRM 4.0?

I need to fetch the parent Subjects using Javascript. How can I get all the 1st level parent subjects? Logic should be like when parentsubject is 'null'. for that I wrote the following query.

 var message =
   [
        "<?xml version='1.0' encoding='utf-8'?>",
        "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema">",
        GenerateAuthenticationHeader(),
        "<soap:Body>",
        "<RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">",
        "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' >xsi:type='q1:QueryExpression' >",
        "<q1:EntityName>subject</q1:EntityName>",
        "<q1:ColumnSet xsi:type=\"q1:ColumnSet\" >",
        "<q1:Attributes>",
        "<q1:Attribute>subjectid</q1:Attribute>",
        "</q1:Attributes>",
        "</q1:ColumnSet>",
        "<q1:Criteria>",
        "<q1:FilterOperator >And</q1:FilterOperator>",
        "<q1:Conditions>",
        "<q1:Condition>",
        "<q1:AttributeName >parentsubject</q1:AttributeName>",
        "<q1:FilterOperator>Equal</q1:FilterOperator>",
        "<q1:Values>",
        "<q1:Value xsi:type='xsd:string'>" _____________ "</q1:Value>",
        "</q1:Values>",
        "</q1:Condition>",
        "</q1:Conditions>",
        "</q1:Criteria>",
        "</query>",
        "</RetrieveMultiple>",
        "</soap:Body>",
        "</soap:Envelope>"
    ].join("");

Please let me know what should I pass in _ __ _ ___

Thanks in advance JK

FilterOperator should be Operator, Equal should be Null, and remove the Values node. So:

"<q1:Condition>",
"<q1:AttributeName >parentsubject</q1:AttributeName>",
"<q1:FilterOperator>Equal</q1:FilterOperator>",
"<q1:Values>",
"<q1:Value xsi:type='xsd:string'>" _____________ "</q1:Value>",
"</q1:Values>",
"</q1:Condition>",

should be

"<q1:Condition>",
"<q1:AttributeName >parentsubject</q1:AttributeName>",
"<q1:Operator>Null</q1:Operator>",
"</q1:Condition>",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM