Control Flow

Response actions support @foreach and @if/@else statements for iteration and branching and a special function cancelAction() for conditional processing.

Control statements that begin with @ must be completed with @end{}.


Use @if/@else/@end syntax (orb tags) for conditional processing.

@if and @else branches accept boolean conditions.


The result of applying this template is the original text less any text contained in branches that evaluates to false. The processed text retains non-printable characters such as space, tabs, and line breaks within the printed branches.

The following example prints the entity tags table in ASCII format for the entity nurswgvml007.

@if{entity == 'nurswgvml007'}
${addTable(entity.tags, 'ascii')}

Multiple checks example:

Action blocked **by calendar**.
@else{!lock(action_command, 300000)}
Action is already **locked**.
${sendTcpMessageReply(host, port, action_command, 5)}


Use the @foreach template to iterate over a collection.

@foreach{item : collection}
  • collection is the name of the iterated collection.
  • item is any name assigned to the current element of the collection.
  • Refer to items in the collection using @{} syntax instead of the regular placeholder ${} syntax.
@foreach{lnk : exLinks}

The result is the original text plus inserted blocks of text for each item in the collection. The produced text includes non-printable characters such as space, tabs, and line breaks inside the @foreach block.

The following example prints an entity link for each entity in the servers collection.

@foreach{srv : servers}
* @{getEntityLink(srv)}

Note that each @ declaration is replaced with text line including line breaks. Position statements properly to avoid extra lines.

The example produces a malformed markdown table since `@foreach{m : msgs}` is replaced with empty line.
| date | type | source |
@foreach{m : msgs}
Generates a proper markdown table.
| date | type | source | message |
@foreach{m : msgs}|@{m.dt}|@{m.type}|@{m.source}| @{truncate(m.message, 128)} |

Conditional Processing

The cancelAction() function can be called in the notification text to cancel the action.

@if{strategy != 'StartOrder'}