Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/channels/emails.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,28 @@ To use custom date fields in tokens, use the following format:

The date outputs in a human-readable format, configured in the settings in your Global Configuration > System Settings under 'Default format for date only' and 'Default time only format'.

Label modifier for select and boolean fields
--------------------------------------------

For select and boolean field types, you can display the human-readable label instead of the stored value by using the ``|label`` modifier:

.. code-block:: php

{contactfield=select_alias|label}
{contactfield=bool_alias|label}

This is particularly useful when these fields contain technical values, but you want to show user-friendly labels in your Emails. For instance:

* A country selection field storing ``us`` can display ``United States``
* A boolean field storing ``1`` can display ``Yes``

The modifier also works with Company fields:

.. code-block:: php

{contactfield=company_select_alias|label}
{contactfield=company_bool_alias|label}

Contact replies
===============

Expand Down
35 changes: 35 additions & 0 deletions docs/configuration/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@ Variables

``Hi {contactfield=firstname|there},``

Token modifiers
***************

Label modifier for select and boolean fields
============================================

For select and boolean type fields, you can use the ``|label`` modifier to display the human-readable label instead of the stored value. It's beneficial when your select fields store values like codes or IDs, but you want to display friendly labels to your Contacts.

**Syntax:**

.. code-block:: text

{contactfield=field_alias|label}

**Examples:**

* For a select field with alias ``country_select`` that has options, such as ``us`` for ``United States`` or ``uk`` for ``United Kingdom``:

* ``{contactfield=country_select}`` displays the value ``us``
* ``{contactfield=country_select|label}`` displays the label ``United States``

* For a boolean field with alias ``is_subscriber``:

* ``{contactfield=is_subscriber}`` displays the value ``1`` or ``0``
* ``{contactfield=is_subscriber|label}`` displays the label ``Yes`` or ``No``

* For both Contact fields and Company fields:

* ``{contactfield=company_type|label}`` displays the label of a Company select field
* ``{contactfield=company_active|label}`` displays the label of a Company boolean field

.. note::

The ``|label`` modifier only works with select and boolean field types. For other field types, it displays the regular value.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuzmany I want to confirm this note. We mentioned that the modifier only works with select and boolean field types.

However, we also mentioned that it also works with Contact and Company field type in the examples. Do we need to update this note?

cc: @mautic/core-team @RCheesley for visibility

Copy link
Contributor Author

@adiati98 adiati98 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the channels/emails.rst, it only mentioned that this modifier works as well with Company field, but it doesn't mention Contact field as below. Do we need to update this as well?

https://github.com/adiati98/mautic-user-documentation/blob/dbd1a338da6eb4ac4121191678e6c15aba14e5fa/docs/channels/emails.rst?plain=1#L205


Contact fields
**************

Expand Down