Conditionally include template files

You can configure template files to be conditionally or dynamically included in DocGen Packages based on Salesforce data. This allows the system to automatically set the appropriate template when user-defined conditions are met.

For instance, you can include a specific template only when a field meets a certain value, such as including a section when Username equals user_name_1. This lets you generate personalized or scenario-specific documents without creating multiple separate packages.

To conditionally include template files:

  1. Open or Create a DocGen Package.

  2. Select the Documents tab.

  3. Do one of the following to edit the DocGen Package:

    1. Click Down arrow next to the package name and select Edit.

    2. Select Edit next to the field you want to edit in the package.

  4. Under Include Template, select Conditionally.

  5. Set up the data field and value.

    1. Select Include or Exclude section if and specify which field to evaluate by entering a tag from the Field Tagger.

    2. Select equals or does not equal or another option, and enter the value you want to evaluate the selected tag with.

Note: This value can be static or dynamic. You can make this value dynamic by entering a tag from the Field Tagger.

Examples of conditional logic statement

If the values above are selected under the Conditionally option, the template will be included in the output only if the Stage field on the Opportunity object is set to Prospecting. If the Stage field in the Opportunity object is equal to Closed Won instead, the template will not be included in the output when you run the DocGen Package.

 

Using a single tag and value for the condition

include section if <<Opportunity_Stage>>

equals: Prospecting

 

Using the AND logic (multiple conditions)

The AND logic can be used by combining multiple values within the Action and Condition clause. The value must be inserted without any spaces or commas.

include section if: <<Tag1>><<Tag2>>

equals: TagValue1TagValue2

 

OR logic (single action (Field Tag))

The single action OR logic can be used by combining multiple values within the Condition clause text box, where the value is separated by commas.

include section if: <<Tag1>>

equals: TagValue1, TagValue2

 

OR logic (multiple actions (Field Tag))

The single action OR logic can be used by combining multiple values within the Action and Condition clause text box, where the value is separated by commas.

Include section if: <<Tag1>><<Tag2>>

equals: TagValue1, TagValue2, TagValue3

  1. Select the Available as Email Body for Delivery option if you want the file to be available as the email body when it is delivered.

  2. Click Save.