You can use Platio Expression Templates to generate a text from a text containing Platio Expressions. You can use expression templates, for example, when you want to embed values in a body of email or push notifications.
A expression template can contain text and expressions surrounded by
${}
. All expressions in an expression template will be
evaluated and replaced by the results. Parameters passed to an
expression template will be passed to each expression in it.
You can specify an expression template to Subject property of Send Email field.
Imagine there is Name field (Text), and you specify
You have a message from ${ cc41ef22 }
to its Subject
property. The subject of an email will be “You have a message from
Micheal” when a user inputs “Micheal” to the Name field. Note that
cc41ef22
is a column ID of the Name field.
You can also specify an expression template to Body property of Send Email field.
Assuming there are Name (Text) and Message (Multiline Text) fields,
and you specify the expression template below to its Body property. Note
that cc41ef22
and cb27077f
are column IDs of
the Name and Message fields.
<p>You have a message from ${ escapeHtml(cc41ef22) }.</p>
<p>${ replace(escapeHtml(cb27077f), /\n/g, "<br>") }</p>
A user specifies “Micheal” to the Name field, and the message below to the Message field.
Hello. I’ll let you know the new version of Platio.
Then, the body of email will be like this.
<p>You have a message from Micheal.</p>
<p>Hello.<br>I’ll let you know the new version of Platio.</p>
Note that you need to escape them using escapeHtml
when you embed
values using an expression template as the Body property accepts
HTML.