1

I am trying to apply 3 filter conditions to a soap call to get DataFolder info. Single conditions are (as SimpleFilterPart elements):

<Filter xsi:type="SimpleFilterPart">
    <Property>ContentType</Property>
    <SimpleOperator>equals</SimpleOperator>
    <Value>email</Value>
</Filter>
<Filter xsi:type="SimpleFilterPart">
    <Property>IsActive</Property>
    <SimpleOperator>equals</SimpleOperator>
    <Value>true</Value>
</Filter>
<Filter xsi:type="SimpleFilterPart">
    <Property>ParentFolder.Name</Property>
    <SimpleOperator>equals</SimpleOperator>
    <Value>my emails</Value>
</Filter>

But in this way only first condition was applied. To combine 2 conditions i have to use ComplexFilterPart, so my selection conditions become:

<Filter xsi:type="par:ComplexFilterPart" xmlns:par="http://exacttarget.com/wsdl/partnerAPI">
   <LeftOperand xsi:type="par:SimpleFilterPart">
      <Property>IsActive</Property>
      <SimpleOperator>equals</SimpleOperator>
      <Value>true</Value>
   </LeftOperand>
   <LogicalOperator>AND</LogicalOperator>
   <RightOperand xsi:type="par:SimpleFilterPart">
      <Property>ContentType</Property>
      <SimpleOperator>equals</SimpleOperator>
      <Value>email</Value>
   </RightOperand>
</Filter>
<Filter xsi:type="SimpleFilterPart">
    <Property>ParentFolder.Name</Property>
    <SimpleOperator>equals</SimpleOperator>
    <Value>my emails</Value>
</Filter>

But in this way only conditions between ComplexFilterPart were applied... How can I set the conditions?

  • You will need to define a second ComplexFilterPart, which will reference you first ComplexFilterPart in the LeftOperand and reference your third SimpleFilterPart in the RightOperand. – David Devoy Jan 20 '17 at 20:11
5

The SOAP logic will look something like this after combining the ComplexFilterParts and SimpleFilterParts.

<Filter xsi:type="ComplexFilterPart">
    <LeftOperand xsi:type="ComplexFilterPart">
        <LeftOperand xsi:type="SimpleFilterPart">
            <Property>IsActive</Property>
            <SimpleOperator>equals</SimpleOperator>
            <Value>true</Value>
        </LeftOperand>
        <LogicalOperator>AND</LogicalOperator>
        <RightOperand xsi:type="SimpleFilterPart">
           <Property>ContentType</Property>
           <SimpleOperator>equals</SimpleOperator>
           <Value>email</Value>
        </RightOperand>
    </LeftOperand>
    <LogicalOperator>AND</LogicalOperator>
    <RightOperand xsi:type="SimpleFilterPart">
        <Property>ParentFolder.Name</Property>
        <SimpleOperator>equals</SimpleOperator>
        <Value>my emails</Value>
    </RightOperand>
</Filter>
  • Thank you @David Devoy, it 3 filter conditions worked like a charm, How can i combine 6 or more filter conditions using 'OR' LogicalOperator... – Sfdcprgmr Mar 5 '18 at 10:29
  • I haven't tried this. But, I'm sure you can nest the filters even further to have complex filter references another complex filter; that references another complex filter ... :) – David Devoy Mar 9 '18 at 20:44
  • Thanks for your suggestion, i have tried two Complex filters are working and i got response successfully but third ComplexFilter is not getting response in Same Filter ComplexFilterPart. FYI " salesforce.stackexchange.com/questions/210327/… " – Sfdcprgmr Mar 12 '18 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.