Reference guide for tokens available within the Twig Templates plugin for Mautic.
contact
)contact
object provides access to the fields of the contact viewing the email or landing page.
contact.firstname
, contact.email
, contact.city
).
contact.custom_field_alias
).
id
and name
.
contact.companies
): Access all companies associated with the contact as an array of company objects. Each object contains the company’s fields.
contact.primaryCompany
): Returns the primary company object if one is set. If no company is explicitly marked as primary, it returns the first company associated with the contact. Returns null
if the contact has no associated companies.
formresult
: An object containing the data from the most recent form submission by the contact for the form that triggered the current action. Field names correspond to form field aliases.
formresults
: An array containing all form submission data for the triggering form and contact. Each element is an object like formresult
.
getFormResults(formId, contactId, limit, page, orderBy, orderDirection)
:formId
(required): The ID of the form.contactId
(optional): The contact’s ID. If omitted or null
, fetches results for all contacts.limit
(optional): Max number of results per page.page
(optional): Page number (default: 1).orderBy
(optional): Field to sort by (default: 's.date_submitted'
).orderDirection
(optional): 'ASC'
or 'DESC'
(default: 'DESC'
).getFormResultsCount(formId, contactId)
:formId
: (Required) The integer ID of the Mautic Form you want to query.contactId
: (Optional) The integer ID of the Mautic Contact. If provided, counts submissions for that specific contact only. If omitted or null
, counts submissions for the form across all contacts.tokens
)tokens
object. See the API Documentation for usage.
now
for the current time) are also available. Refer to the official Twig Documentation for more on standard Twig capabilities. For accessing Custom Objects data, see the Custom Objects Support page.