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.

  1. In Microsoft Word, click the Insert tab.
  2. Click Quick Parts in the Text group, then click Field.
  3. Select If in the Field names box on the left side panel.
    • The Field codes box will automatically input IF into the field.
  1. Enter in a formula in the Field codes box.
  2. 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.

  3. 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

  1. 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.
  1. 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.
  2. 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.
  3. 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.

  4. When the field code is correct, right click the formula and select Update Field.
  5. You will know the formula is correct when it turns into an unchecked checkbox in your Microsoft Word document.
  6. Navigate to DocGen Packages and run your DocGen Package as normal.

    The output of your template would look similar to the results below based on the DocGen Package you use.