Skip to main content

sendToWorkflow

A Workflow Engine function that sends the in-scope object to a named workflow in an informs based engine. This allows for additional flexibility in workflow execution. You can step out of the currently executing workflow while avoiding some of the complexities of the skip function. The function is a wrapper for the MoogDBv2 sendToWorkflow API.

The destination Workflow Engine must be an informs based engine. Informs engines execute only the named workflow without executing subsequent workflows within the engine. By default you can choose the Alert Inform Engine or the Situation Inform Engine.

The sendToWorkflow function does note stop the current workflow after it executes. If you want to stop subsequent workflows, use the stop function after sendToWorkflow.

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

Back to Workflow Engine Functions Reference.

Arguments

Name

Required

Type

Description

engineName

yes

string

Name of an inform based workflow engine. For example, Alert Inform Engine or Situation Inform Engine.

workflowName

yes

string

Name of the workflow within the inform based engine.

context

no

object

Optional workflow context object. For example {"key":"value"}. If you don't supply a context, sends the currently active context.

Example

The following example demonstrates typical use of Workflow Engine function sendToWorkflow. Imagine you want to send an alert to a workflow named "Export Data" in the "Alert Inform Engine" that performs an asynchronous alert data export outside the linear alert workflow. The workflows in Alert Workflows are not blocked waiting for the export to complete.

Set the following:

  • engineName: Alert Inform Engine

  • workflowName: Export Data

  • context: {"details":"Export example: $(alert_id)"}

The UI translates your settings to the following JSON:

{"engineName":"Alert Inform Engine","workflowName":"Export Data","context":{"details":"Export example: $(alert_id)"}}

For an alert with id 28, the Workflow Engine passes the alert to the Export Data workflow in the Alert Inform Engine with the following context:

{"details":"Export example: 28"}

You can use the createPayload and copyToPayload actions in the Export Data workflow to prepare the alert data for export. copyToPayload has access to the workflow context you sent. To add the workflow context data to the export, set the following:

  • payloadKey: details

  • value: $(workflowContext.details)

Finally, set up an export action to export the data.