Conditional Text In Word
Use Conditional Text in Microsoft Word to input text to make your document dynamic. Microsoft Word allows you to be able to have a checkbox appear instead of a long text string or tables instead of paragraphs.
For example, say you want to create a document that shows how many employees are included in an account. You want the document to use a checked checkbox for an Employee value greater than 50 and unchecked checkbox for an Employee value less than 50.
To watch video tutorials on how to use this Nintex capability, take the CERT: Nintex Document Generation Expert - Nintex DocGen for Salesforce in Nintex University. |
Insert fields in Microsoft Word
The first step to make your documents dynamic is to add field formulas into your Microsoft Word document.
- In Microsoft Word, click the Insert tab.
- Click Quick Parts in the Text group, then click Field.
- Select If in the Field names box on the left side panel.
- Enter in a formula in the Field codes box.
- For our example, we would enter in:
IF "<<Account_NumberofEmployees>>" > "50" "T" "F"
- Include quotes (" ") in the true ("T") and false ("F") statements.
Note: If you are evaluating numbers, you should exclude quotes from the evaluation portion of the IF formula. The quotes can remain for the true and false statements because they are not numbers.
- Click OK.
Tip: If printing your output to PDF, set your Microsoft Word template to update fields automatically before printing. Click File > Options > Display, and under Printing options, select the check box to Update fields before printing.
Customizing the IF formula
- To display the checkbox instead of the true (T) and false (F) statements, highlight the "F", then right click and select Toggle Field Codes. The full formula will be displayed.
- Highlight just the "T" in the formula and replace it with a Wingdings 2 checked checkbox symbol using the Symbol button in the Symbols group.
- Highlight just the "F" in the formula and replace it with a Wingdings 2 unchecked checkbox symbol using the Symbol button in the Symbols group.
- Your formula should look like below:
{ IF "<<Account_NumberOfEmployees>>" > "50" "R" "0" \* MERGEFORMAT }
If the Employee value is greater than 50, a checked checkbox will appear, if there are less than 50, an unchecked checkbox will appear.
- When the field code is correct, right click the formula and select Update Field.
- You will know the formula is correct when it turns into an unchecked checkbox in your Microsoft Word document.
- Navigate to DocGen Packages and run your DocGen Package as normal.
- For more information on DocGen Packages, see DocGen Packages.
The output of your template would look similar to the results below based on the DocGen Package you use.