Introduction
It is possible to format a personalisation field so that it has a modified output rendering.
Prerequisite: have the omnichannel api configured on the NMP.
Formatting a personalisation field
To format a personalisation field, you need to apply the desired transformation within the email content.
Formatting a field is based on the following principle:
- MM:FIELD|myfunctiontoapply with
- MM:FIELD: the field to be formatted
- |: the character to be used to introduce the use of a formatting function
- myfunctiontoapply: the formatting function to be applied
The following formatting options are available:
| Function name | Description |
|
{{MM:FIELD|urlencode}} |
Used to encode a value, such as a url |
|
{{MM:FIELD|int}} |
Allows to have an entire format. The source field used must be one of the following types: int, float, or str. If str, a value containing a space is only tolerated in the following cases:
Spaces are not tolerated and cause the conversion to fail in the following case:
|
|
{{MM:FIELD|upper}} |
Allows all text to be capitalized |
|
{{MM:FIELD|lower}} |
Allows all text to be in lower case |
|
{{MM:FIELD|capitalize}} |
Allows you to have the first letter in uppercase and the rest in lowercase (example: Hello to you). |
|
{{MM:FIELD|title}} |
Allows you to capitalize the first letter and lowercase the rest of the word (example: Hello To You). |
|
{{MM:FIELD|datetimeformat(format="%Y/%m/%d à %H:%M:%S", tz="Europe/Paris")}} |
From an ISO format (e.g.: 2024-10-03T10:15:30+01:00) or without any hours and minutes (e.g.: 2011-12-03), be able to define the desired date format as output. Any other input format will not be accepted. Each character mentioned in the format section is used to select specific information relating to a date. The correspondences are as follows: - Y: year - m: month - d: day - H: hour - M: minute - S: second
Note that / or - separators can be added independently within the formatting, as required. Examples of use: - dd/mm --> {{MM:CHAMP|datetimeformat(format="%d/%m", tz="Europe/Paris")}} |
| {{MM:FIELD|humanduration}} |
From a value in seconds, be able to transform it into hours/minutes Examples of use: - 1800 → 30 min
For information, it is possible to adapt a unit from the minute to the second by the following means: - define a new variable at the start of the content, which will leverage the one sent: - all that remains is to use the new variable in your content: {{MM:MA_VARIABLE_SECONDS|humanduration}} |
Conclusion
Campaign formatting allows you to modify a value in a customization field according to a specific format.