Skip to main content

contextValueFilter

A Workflow Engine function that performs a value filter check on a workflowContext key value. The values argument is a list of possible values, which can be equality (the key value is an exact match for the specified value), or a regular expression check. The regular expression check can be either negative or positive (example: !/value/ or /value/ ), and is case insensitive.

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

This function is available for event, alert, and Situation workflows.

Back to Workflow Engine Functions Reference.

Notes

  • Regular expressions must be double escaped; for example, \d needs to be expressed as \\d.

  • The values parameter is always specified as a list (even if there is just a single value).

    Note

    This list is handled as an OR operation: if any value matches, the function returns "true," (not as an AND, which would only return "true" when all values match).

For example, when testing to check if a value is equal to one of the following:

"A value"
"test99"
"test100"
NOT "critical"

You could use this list for values:

[ "A value", "/test\\d+/", "!/critical/" ]
  • “A value” would be evaluated for equality.

  • /test\\d+/ would be evaluated as a positive regular expression.

  • !/critical/ would be evaluated as a negative regular expression; it would return true if the value did not contain “critical”.

Arguments

Workflow Engine function contextValueFilter takes the following arguments:

Name

Required

Type

Description

key

yes

string

Then name of the workflow context key whose value to check.

values

yes

object (array)

A list of possible values.

Example

To check to see if the workflowContext key myKey:

  • contains a specific value: “Node down” OR

  • contains a value starting with “critical” OR

  • has a pattern of an IP address

The function would be defined as:

  • key : myKey

  • values : [ “Node down” , “/^critical/” , “/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/” ]

{"key":"myKey","values":["Node down","/^critical/","/(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/"]}