Welcome to Zuora Product Documentation

Explore our rich library of product information

Multiple IF conditions based on SOQL column value

Learn how to implement multiple IF conditions in S-Docs using a workaround with SOQL column values.

Multiple if condition based on SOQL column value is not supported in S-Docs. Following is a workaround to overcome this limitation:

  1. Create a parent template and add the following component template so that multiple if conditions can be used in the component template using column value from the parent template.
    <!--{{! <LineItemsSOQL>
              <class>None</class>
              <soql>select id,zqu__QuoteRatePlan__r.name,name,zqu__Quantity__c, zqu__EffectivePrice__c, zqu__Total__c from zqu__QuoteRatePlanCharge__c where zqu__QuoteRatePlan__r.zqu__Quote__c ='{{!ObjectID15}}'</soql>
    <component columnFields="true" mergeFieldPrefix="QuoteRatePlanCharge">Component_Template</component>
      <column componentMergeField="true">zqu__QuoteRatePlan__r.name</column>
      <column componentMergeField="true">name</column>
    <column componentMergeField="true">zqu__Quantity__c</column>
    <column componentMergeField="true">zqu__EffectivePrice__c</column>
    </LineItemsSOQL> }}-->
  2. Add the following to the component template:
    <table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
    <tbody>
    <tr>
    <td style="width: 150px;">{{!QuoteRatePlanCharge.name}}</td>
    <td style="width: 150px;">
    <pre>
    &lt;!--RENDER='{{!QuoteRatePlanCharge.name}}'== 'New Component' --&gt;
      Condition one true
      &lt;!--ENDRENDER--&gt;
    &lt;!--RENDER='{{!QuoteRatePlanCharge.zqu__QuoteRatePlan__r.name}}'== 'second pp' --&gt; Condition two true &lt;!--ENDRENDER--&gt;
    &lt;!--RENDER='{{!QuoteRatePlanCharge.zqu__QuoteRatePlan__r.name}}'== 'second pp' &amp;&amp; '{{!QuoteRatePlanCharge.name}}'== 'New Component' --&gt; Both condition true &lt;!--ENDRENDER--&gt;
    </pre>
    </td>
    <td style="width: 150px;">{{!QuoteRatePlanCharge.zqu__quantity__c #,###}}</td>
    <td style="width: 150px;">{{!QuoteRatePlanCharge.zqu__effectiveprice__c #,###}}</td>
    </tr>
    </tbody>
    </table>