removeMatchingSituationFlags

A Workflow Engine function that allows a set of Situation flags to be removed simultaneously based on a regular expression match.

This function is available as a feature of the Add-ons v2.4 download and later.

This function is available for Situation workflows only.

Back to Workflow Engine Functions Reference.

Flag definition syntax

Flags are defined using the following syntax:

  • An equality check (case and whitespace sensitive).

  • A positive regular expression

  • A negative regular expression

An equality check has the same action as the removeSituationFlag action.

A positive regular expression (case insensitive):

/<pattern>/

A negative regular expression (case insensitive):

!/<pattern>

For example, given a Situation with the following flags:

[
    "EMAIL",
    "EMAIL_99",
    "TESTING",
    "TESTING_123",
    "TESTING_1234"
]

A positive expression for Email.* would be

/^email/

A negative expression for email (remove all flags that aren’t email) would be

!/^email/

Note

Care needs to be taken when defining a regular expression to ensure it is not too “greedy” - use anchors (^,$) as needed.

Arguments

Workflow Engine function removeMatchingSituationFlags takes the following arguments:

Name

Required

Type

Description

flags

yes

string

A regular expression using the “/<pattern>/” and “!/<pattern>/” syntax. Flags matching this expression will be removed.

Example

The following example demonstrates typical use of Workflow Engine function removeMatchingSituationFlags.

Given a Situation with the following flags:

[
    "EMAIL",
    "EMAIL_99",
    "TESTING",
    "TESTING_123",
    "TESTING_1234"
]

and a requirement to remove all flags that start with “email” (e.g. those set via the email integration):

  • flags : /^email/

This would appear in the UI as:

{"flags":"!/^email/"}

When executed this would remove the “EMAIL” and “EMAIL_99” flags from the Situation.