Skip to main content

workflowContextSearchAndReplace

A Workflow Engine function that allows you to use regular expressions to extract values from the workflow context and add them to an workflowContext.extract object. The data is available for use in subsequent actions.

This function is available as a feature of the Add-ons v2.1 download and later. See Install Moogsoft Add-ons for information on how to upgrade.Install Moogsoft Add-ons

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

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function workflowContextSearchAndReplace takes the following arguments:

Name

Required

Type

Description

field

yes

string

The name of the workflowContext field to apply the expression (extraction) to.

expression

yes

string

A regular expression with subgroups to apply to the field.

Example

Given a starting workflow context:

{
    "application": "app001",
    "linkEstablished": "Resource server001 connected to resource db001",
}

Set the following arguments in the workflowContextSearchAndReplace action:

  • field : application

  • expression : Resource (.*) connected to resource (.*)

The workflow context would contain the following after the action ran:

{
    "application": "app001",
    "linkEstablished": "Resource server001 connected to resource db001",
    "extract": {
        "1": "server001",
        "2": "db001"
    }
}

workflowContext.extract would contain the extracted subgroup values from the expression. These values can be used in subsequent actions through substitution (e.g. $(workflowContext.extract.1) would be substituted by “server001”).