Related help articles
The syntax used for conditions in documents is called Jinja and it is a way to write code inside documents that lets you control what content gets shown based on certain rules. It’s like a set of instructions that can say, "If this part is true, show this text; otherwise, show something else."
Syntax examples
{% if variable != 'value' %}
<!-- Content to display if variable is not equal to 'value' -->
{% endif %}
{# This is a comment and won't affect the code #}
{% if name != "Bob" %}
Hello, {{ name }}! You are not Bob.
{% else %}
Hello, Bob!
{% endif %}
Journey specific examples
All spaces and new lines are also included in the document and these examples there are not extra spaces or lines added.
Display one text if contract type is "Temporary" and another text if contract type is "Permanent". If contract type is neither, nothing is displayed.
{% if contract_type == 'Temporary' %}Text displayed for temporary contracts.{% elif contract_type == 'Permanent' %}Text displayed for permanent contracts.{% endif %}
Display text if contract type is "Temporary" and no text if contract type is anything else:
{% if contract_type == 'Temporary' %}Text displayed for temporary contracts.{% endif %}
Display text if contract type is "Temporary" and another text if contract type is anything else:
{% if contract_type == 'Temporary' %}Text displayed for temporary contracts.{% else %}Text displayed if contract is anything else than Temporary.{% endif %}
You can also display values from other variables like this.
{% if some_variable == 'value' %}To display the value for name and department, {{name}}, {{department}}.{% endif %}
Testing the document
After adding your Jinja code to the document, it’s important to test it to ensure everything functions correctly. Even a small extra space in the wrong place can alter the outcome and prevent it from working as intended.
Fill out the "Test value for preview", click Preview and check that the correct text is displayed and the format is ok.
Troubleshooting
Make sure that there is no spaces or special characters inside the variables/fields {{no_spaces_or_special_characters}}. See more here.
Make sure that there is no space between { and %. It should always look like this {% something %}.
Demo documents
Here below are some demo documents that you can try