Skip to main content

Conditional Sections in Document Templates

Updated over a month ago

Overview

This section explains how to use condition tags in docuWeaver document templates.

Condition tags control the conditional display of content based on Salesforce field values. They evaluate defined conditions at the template level and render specific sections only when the condition evaluates to true.

This allows you to tailor document content dynamically without creating multiple templates.


Example

Goal:


Display different content based on the Account Type field.

Template Example

{#$r.Type == 'Premium'}

Premium account content

{/}

{#$r.Type == 'Standard'}

Standard account content

{/}

Behavior

  • If Type = Premium, only the Premium account content is displayed.

  • If Type = Standard, only the Standard account content is displayed.

  • If the condition is not met, the enclosed content is omitted from the generated document.


Steps to Use Condition Tags

  1. Prepare the document template in .docx format.

  2. Log in to Salesforce and open the docuWeaver application.

  3. Navigate to the Data Set section.

  4. Click Edit on the data set that retrieves the required Salesforce data.

  5. Open the Field Tagger section.

  6. Select the Salesforce object from which the data will be retrieved.

  7. Copy the required field tags from the Field Tagger panel.

  8. Insert the copied field tags into the document template where data should appear.

  9. Identify the section or content that should display conditionally.

  10. Wrap that content with condition tags, as shown in the example above.

  11. Save the document template.

  12. Upload or update the template in docuWeaver.


Note

  • Condition tags always start with {#} and end with { / }.

  • The content between these tags is rendered only when the condition evaluates to true.

  • Conditions can be based on any supported Salesforce field available in the selected data set.

This approach helps maintain a single, flexible template while dynamically controlling document output.

For more information, refer to the documentation - docuWeaver document management

Did this answer your question?