Skip to main content

mergeSituations

A Workflow Engine function that merges two or more Situations, creating a new Situation, and optionally keeps the original (source) Situations open. This action is primarily designed to be called as part of an external workflow (using the sendToWorkflow Graze API call), but works in the standard Workflows (such as the Situation Workflows).

The resulting merged Situation ID is copied to the (workflowContext.mergedId) for use in subsequent actions.

Note

Subsequent actions in the workflow will still use the original trigger Situation and not the newly created merged Situation. If you want actions to be taken on the merged Situation, then use the sendToWorkflow action, which now supports sending a specified id to a target workflow. The merged Situation id can be retrieved from the workflow context after a successful merge.

Use cases
  • Called externally, this action can be part of a workflow that performs additional actions; for example, adding correlation info to the new Situation as part of the merging workflow.

  • Called inline, this action can be part of a workflow that consolidates multiple related Situations into one; for example, merge the trigger Situation with other open Situations with a similar description.

    When called inline (a non-Inform workflow), the Swept up Situations (associated Situations) can be merged with the trigger Situation.

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

This function is available for alert and Situation workflows.

The workflow sweep up filter applies to this function.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function mergeSituations takes the following arguments.

Name

Required

Type

Description

situationIds

yes

string

The list of Situation Ids to be merged. For an Inform-based workflow, this is usually passed as part of the workflow context and would use a substitution (for example: $(workflowContext.sitn_ids).

For an inline workflow, this is left as an empty list [ ]. The merge list is the trigger and associated Situations (from the Sweep up filter).

keepOriginals

no

string (true|false)

Optionally, specify if the source Situations should be left open and active, or moved to a Superseded category.

Default is false, original source Situations are marked as Superseded.

mergeAssociated

no

string (true|false)

Specify if the merge list should be taken from the trigger and associated Situations.

Example

Externally triggered workflow

An external system wants to merge two Situations together:

  • Create a Situation Inform Engine workflow that calls the mergeSituations action (example: mergeExternalSituations).

    situationIds : $(workflowContext.sitn_ids)

  • In the external system, POST a request to:

    https://<moog_ui_server>/graze/v1/sendToWorkflow

    with the following payload:

    { 
    	"engine_name" : "Situation Inform Engine",
    	"workflow_name" : "mergeExternalSituationd",
    	"context" : {
    		"sitn_ids" : [ <sig_id_1>, <sig_id_2>, ... , <sig_id_n> ]
    	}
    }

This will run the workflow, and the context.sitn_ids will be used for the merge list.

Internally triggered workflow

Important

Take care when using this workflow pattern to ensure that the workflow only works within the intended scope (for example, using First Match Only, or appropriate filters). It is possible to create a workflow that merges all Situations into one by using inaccurate filters for the trigger or sweep up.

When a specific Situation is created, merge associated Situations with it.

  • Create a Situation Workflow which calls the mergeSituations action.

    • The workflow should have a suitable entry filter to identify the trigger Situation.

    • The workflow should have a suitable Sweep Up filter to identify the “victim” Situations.

  • In the mergeSituations action:

    • situationIds : [ ]

      An empty list - the action adds the trigger Situation id to the list

    • keepOriginals : false

    • mergeAssociated : true

The action adds the Swept Up Situation Ids to the merge list and attempts to merge them.