Simple

How to Format Rules with a Custom-Built Solution for Basic Use Cases

When we started to introduce placeholders we defined limited sets of placeholders, but the system was just too inflexible for users. To make it more flexible, a new system was introduced, with 4.2.0. This gives access to all properties.

The syntax is very easy:

${<TYPE>_<PROPERTYAME>} or 
${<TYPE>_<PROPERTYAME> | filters} or 
$<TYPE>_<PROPERTYNAME>

The <TYPE> is a prefix that has been used for backwards compatibility and users may use whatever they want but the best recommendation is to use prefixes that fit the type of event, for example, content or asset. The <PROPERTY> is the full path to the property in the event, for example:

  • $CONTENT_TYPE: Created

  • $CONTENT_SCHEMAID.NAME: my-schema

  • $CONTENT_DATA.CITY.en: Munich

If possible, always use the first variant with the brackets ( { and } ).

Special Placeholders

Furthermore, there are still some special placeholders for backwards compatibility or to grant access to information that is not directly part of the event.

EventDescriptionNew Alternative

$APP_ID

The id of your app (GUID).

${EVENT_APPID.ID}

$APP_NAME

The name of your app.

${EVENT_APPID.NAME}

$USER_ID

The id of the user (or client).

${EVENT_USER.ID}

$USER_NAME

The display name of the user (or client name).

${EVENT_USER.NAME}

$USER_EMAIL

The email address of the user (or client name).

${EVENT_USER.EMAIL}

$TIMESTAMP_DATE

The date when the event has happened (usually different from the time when the rule is executed) in the following format: yyyy-MM-dd.

$TIMESTAMP_DATETIME

The date when the event has happened (usually different from the time when the rule is executed) in the following format: yyyy-MM-dd-hh-mm-ss.

EventDescriptionNew Alternative

$SCHEMA_ID

The name of the schema.

${EVENT_SCHEMAID.ID}

$SCHEMA_NAME

The name of the schema.

${EVENT_SCHEMAID.ID}

$CONTENT_URL

The URL to the content in the administration tool.

$CONTENT_ACTION

The content action, e.g. CityContentCreated.

${EVENT_TYPE}

Special Placeholders for Comment Events

EventDescriptionNew Alternative

$MENTIONED_ID

The id of the mentioned user.

${EVENT_MENTIONEDUSER.ID}

$MENTIONED_NAME

The display name of the mentioned user.

${EVENT_MENTIONEDUSER.NAME}

$MENTIONED_EMAIL

The email address of the mentioned user.

${EVENT_MENTIONEDUSER.EMAIL}S

Special Placeholders for Asset Events

EventDescription

$ASSET_URL

The download URL of the asset.

Filters

This simple syntax also supports a few function filters when using the new syntax:

${<TYPE>_<PROPERTYAME> | filters} 

The following table uses:

NameDescriptionExample

lower

Converts the input to lowercase.

Hello World

=> hello world

upper

Converts the output to uppercase.

Hello World

=> HELLO WORLD

escape

Escapes the input to a JSON string.

Hello "World" => Hello \"World\"

slugify

Converts the input to a slow, which can only contain a-z0-9 and -.

Hello World

=> hello-world

trim

Removes whitespaces at the start and end of the input.

Hello World => Hello World

timestamp

Parses the input as ISO8601 datetime string and converts it to a unix timestamp using milliseconds.

2023-01-10T10:41:32 => 1673347292000

timestamp_sec

Parses the input as ISO8601 datetime string and converts it to a unix timestamp using seconds.

2023-01-10T10:41:32 => 1673347292

Filters can also be combined:

${CONTENT_DATA.CITY.en | uppercase | escape} 

Last updated