When rendering the Outcomes, AutoDocument will perform field substitution using the “curly brace” syntax: {{ }}
. You don’t need to add any special “field” objects or anything else into your Word Document Templates.
Simple add {{ field }}
anywhere at it will be replaced by the value of that field when running the Workflow.
There are also a slew of other useful templating tools available, such as the curly brace + percent syntax, which denotes adding logic to the template. For example:
{% if show_warning == 1 %}
Warning: surface is hot
{% endif %}
You also use the {% %}
syntax when iterating over multi-records sources that have been set to a field:
{% for item in purchases %}
{{ item.name }}: {{ item.quantity }} @ {{ item.price }} - Total Price: {{item.value}}
{% endfor %}
AutoDocument uses the powerful Jinja2 for templating, and so has access to all the wonderful features that Jinja2 has. See their documentation for more info.
AutoDocument uses the fantastic python-docx-template library for templating in Microsoft Word. This uses Jinja2 under the hood so the syntax is the same no matter what Outcome you use, however it adds some other Word-specific tools to make working with it more convenient, like the {%p %}
syntax for working with paragraphs. See their documentation for the full list of features.