Skip to main content

sendAddedAlertsToWorkflow

A Workflow Engine function that allows alerts to be sent to a named workflow (using the sendToWorkflow function) when they are added to a Situation. This function only works with SigAction-driven workflows (using the Situation Actions engine), and relies on data that is part of the SigAction payload.

This function should be used in conjunction with the sigActionFilter function and filter on the “Added Alerts to Situation” function.

Warning

It is recommended that you limit the scope of this function (such as by using a threshold) when in use, and use caution so that any target workflow does not impair performance on either the Moogsoft Onprem system or the third-party system a workflow communicates with (such as ticketing or notification).

If you do not use a suitable alert threshold, there may be a downstream performance impact under load or flood, when many alerts are rapidly added to a Situation. For this reason, a default threshold of 20 alerts is applied if one is not explicitly specified. If you choose to increase this threshold, ensure that target workflows and/or external systems will be able to manage the load/backlog.

The use case where this function is most frequently requested is “Add a work note to a trouble ticket with the alert details when an alert is added to a Situation."

Moogsoft does not recommend using this function for this use case. The load this function adds may Increase pressure on the neighboring API and cause internal delays at the outbound integration Moolet. Instead, send a work note on the Situation creation containing a context link to the Situation alert list, or send an alert summary as a work note once the Situation is closed.

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

This function is available for Situation workflows only.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function sendAddedAlertsToWorkflow takes the following arguments:

Name

Required

Type

Description

threshold

no

number

The threshold of total alerts in the Situation. If the total_alerts in the Situation exceeds this threshold, then this function returns false; newly added alerts are not be forwarded to the target workflow. Default = 20.

engineName

yes

string

Name of an active Inform Workflow Engine.

workflowName

yes

string

Name of an active workflow within the specified Inform Workflow Engine.

context

no

object

A JSON object of data passed to the target workflow. The triggering Situation id (sig_id) is always added.

Example

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

When an alert is added to a Situation, we want to execute a workflow against the alert to update the alerts custom_info with a “triage” flag.

In the Situation Action workflow, define a new workflow:

  • Workflow Name : setAlertTriageFlag

  • Entry filter (optional) : you can use a total_alerts filter here to enforce the threshold.

  • Action 1 : sigActionFilter

    • actionTypes : [ “Added Alerts To Situation” ]

  • Action 2 : sendAddedAlertsToWorkflow

    • threshold : enter a threshold if desired, default is 50

    • engineName : Alert Inform Engine

    • workflowName : setCIFlag

    • context : { “flag” : “triage” }

This example appears in the UI as:

{"threshold":5,"engineName":"Alert Inform Engine","workflowName":"setCIFlag","context":{"flag":"triage"}}

In the Alert Inform Engine:

  • Workflow Name : setCIFlag

  • Entry filter (optional) : add a filter to limit the scope of the action

  • Action 1 : setCustomInfoValue

    • key : “status”

    • value : “$(workflowContext.flag)”

When an alert is added to the Situation, the setAlertTriageFlag workflow will run, sending the alert to the setCIFlag workflow, passing the flag value in the context. The setCIFlag workflow updates the alert using the value passed into the action’s workflow context.