AnsweredAssumed Answered

Creating Word document DDP with nested IF conditional statements

Question asked by martinh909 on Nov 11, 2016

The use case for this is,

- If the Salesforce Opportunity Category is not "Print" and the Type is "Setup Fee" then display the Salesforce Opportunity field tagger value in the Word table cell.


I want to embed this nested IF conditional statement into a table cell in a Word document,

 

if "<<Opportunity_LineItem_Category>>" <> "Print"  AND IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" THEN display "<<Opportunity_LineItem_UnitPrice>>" ELSE ""

 

Steps to do this in a Word document that you will be using to generate your DrawLoop DDP:

 

1. Click in the table cell, do Control-F9 twice which will create two sets of squirelly brackets { {  } }

To see this right-mouse click Toggle Field Codes in the cell.


2. Inside the innermost { } I copy/paste, IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" "<<Opportunity_LineItem_UnitPrice>>" ""

 

e.g. { { IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" "<<Opportunity_LineItem_UnitPrice>>" "" } }


3. In the outer { } I copy/paste the first half of the outer IF statement, if "<<Opportunity_LineItem_Category>>" <> "Print"

 

e.g. { if "<<Opportunity_LineItem_Category>>" <> "Print" { IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" "<<Opportunity_LineItem_UnitPrice>>" "" } }


4. In the last half of the outer { } , paste in, ""

 

e.g. { if "<<Opportunity_LineItem_Category>>" <> "Print" { IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" "<<Opportunity_LineItem_UnitPrice>>" "" } "" }


5. The completed nested IF condition looks like this:
 

{ if "<<Opportunity_LineItem_Category>>" <> "Print" { IF "<<Opportunity_LineItem_Price_Type>>" = "Setup Fee" "<<Opportunity_LineItem_UnitPrice>>" "" } "" }

Outcomes