2

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?

1
  • 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. Jan 20, 2017 at 20:11

1 Answer 1

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>
3
  • 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, 2018 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 ... :) Mar 9, 2018 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, 2018 at 6:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .