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:
-
Open or Create a DocGen Package.
-
Select the Documents tab.
-
Do one of the following to edit the DocGen Package:
-
Click
next to the package name and select Edit. -
Select
next to the field you want to edit in the package.
-
-
Under Include Template, select Conditionally.
-
Set up the data field and value.
-
Select Include or Exclude section if and specify which field to evaluate by entering a tag from the Field Tagger.
-
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.
| Action Clause | |
|---|---|
| Include Section If | This clause will include sections of the template if the condition is met. |
| Exclude Section If | This clause will exclude sections of the template if the condition is met. |
| Condition Clause | |
|---|---|
| is greater than or equal to | For numeric data. The condition is met if the value is greater than or equal to the specified value. |
| is less than or equal to | For numeric data. The condition is met if the value is less than or equal to the specified value |
| is greater than | For numeric data. The condition is met if the value is greater than the specified value. |
| is less than | For numeric data. The condition is met if the value is less than the specified value. |
| does not contain | For alphanumeric data, this condition evaluates the complete value you specify. It is met whenever the data includes the value, whether as a complete match or as a partial match. |
|
contains |
For alphanumeric data, this condition evaluates the complete value you specify. It is met whenever the data includes the value, whether as a complete match or as a partial match. |
| ends with | For alphanumeric data. This condition is met if the data contains a specified value at the end of the source value. |
| starts with | For alphanumeric data. This condition is met if the data contains a specified value at the start of the source value. |
| does not equal | For alphanumeric data. This condition is met when the data is different from the specified value, |
| equals | For alphanumeric data. This condition is met if the data matches the specified value. |
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
-
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.
-
Click Save.