DOCX Template Variables
DocuTrust supports variable substitution in DOCX templates. Use[[variable_name]] syntax to insert dynamic content, and [[if:variable]]...[[end]] for conditional blocks that appear only when a variable has a value.
Variable syntax
Basic variables
Wrap variable names in double square brackets:[[variable_name]] placeholder is replaced with the corresponding field value from the signer’s submission.
Example DOCX content:
Variable naming rules
Conditional blocks
Use[[if:variable]]...[[end]] to create sections that only appear when the referenced variable has a non-empty value.
addendum_text is empty or not provided, the entire block (from [[if:addendum_text]] to [[end]]) is removed from the final document.
Nested conditionals
Conditional blocks can be nested:Built-in variables
DocuTrust provides several built-in variables that are automatically available in every DOCX template. You do not need to define fields for these — they are populated from the submission context.
Example using built-in variables:
Mapping fields to variables
DOCX variables are mapped to template fields by the field’skey property. When you create a template from a DOCX file, DocuTrust auto-detects [[variable_name]] placeholders and creates corresponding fields in the schema.
Automatic field creation
When uploading a DOCX with variables:[[variable]] placeholders and creates text fields for each one. The resulting template schema:
Built-in variables (
signer_name, signer_email, signing_date, submission_id, template_name) are not created as fields since they are populated automatically from the submission context.Pre-filling variables via submission
When creating a submission, pre-fill DOCX variables using thevalues object keyed by the field’s key property:
Formatting in DOCX
DOCX variables preserve the formatting of the surrounding text. If[[company_name]] is bold in the DOCX file, the substituted value will also be bold.
Formatting rules: