Skip to main content

copySigCorrelationInfo

A Workflow Engine function that copies Correlation Info from a list of source situations to a list of target situations. If an optional service is supplied, only the Correlation Info for matching services will be copied. The service can either be an exact service name, or use a regular expression using /regex/ syntax (ex. /ServiceNow.*/)

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

This function is available for Situation workflows only.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function copySigCorrelationInfo takes the following arguments:

Name

Required

Type

Description

from

yes

string

A list of situation IDs of the source situations.

to

yes

string

A list of situation IDs of the target situations.

serviceName

no

string

The name of the service.

Example

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

We have two situations that are each linked to an external system with external_ids populated in Situation Correlation Info:

[
  {
    "external_id": "my_external_id_1",
    "sig_id": 1,
    "service_name": "MyService1",
    "properties": "{\"service_name\":\"MyService1\",\"external_id\":\"my_external_id_1\"}"
  }
]
[
  {
    "external_id": "my_external_id_2",
    "sig_id": 2,
    "service_name": "MyService1",
    "properties": "{\"service_name\":\"MyService1\",\"external_id\":\"my_external_id_2\"}"
  }
]

We want to manually merge the situations and have their Correlation Info added to the new merged situation.

We can do this by creating a Situation Delta workflow containing three actions.

  1. Restrict the workflow to just handle “Created By Merge” sigActions:

    Action Name

    Created by merge

    Function

    sigActionFilter

    Arguments

    {"actionTypes":["Created By Merge"]}

    Forwarding Behavior

    stop this workflow

  2. Next we retrieve the details from the sigAction and add to the workflowContext:

    Action Name

    Get sigAction data

    Function

    getSigActionData

    Arguments

    {}

    Forwarding Behavior

    always forward

    Using the default arguments, the situation IDs for the original situations will now be held in the following workflowContext path: actionDetails.details.original_situations

  3. Take the Correlation Info from the two original situations and add the current (merged) situation:

    Action Name

    Copy Correlation Info

    Function

    copySigCorrelationInfo

    Arguments

    {"from":"$(workflowContext.actionDetails.details.original_situations)","to":"[$(sig_id)]"}

    Forwarding Behavior

    always forward

  4. When the situation merges, the new merged situation will now hold the correlation from both original situations:

    [
      {
        "external_id": "my_external_id_1",
        "sig_id": 1,
        "service_name": "MyService1",
        "properties": "{\"service_name\":\"MyService1\",\"external_id\":\"my_external_id_1\"}"
      },
      {
        "external_id": "my_external_id_2",
        "sig_id": 2,
        "service_name": "MyService1",
        "properties": "{\"service_name\":\"MyService1\",\"external_id\":\"my_external_id_2\"}"
      }
    ]