Skip to main content

createWorkflow

A MoogDb v2 method that creates a new workflow at the end of a Workflow Engine Moolet sequence. To move it, use reorderWorkflows.

Back to MoogDb V2 API Method Reference.

Request arguments

Method createWorkflow takes the following request arguments:

Name

Type

Required

Description

moolet_name

String

Yes

Name of the Workflow Engine Moolet that the new workflow belongs to.

workflow_name

String

Yes

Name of the new workflow. Must be unique.

description

String

No

Description of the new workflow.

entry_filter

JSON Object

No

An SQL-like filter to determine which events, alerts or Situations can enter the workflow. Leave empty for the workflow to accept all events, alerts or Situations.

See Filter Search Data for more information on creating SQL-like filters.

sweep_up_filter

JSON Object

No

An SQL-like filter to intake any additional events, alerts or Situations from the database.

See Filter Search Data for more information on creating SQL-like filters.

sweep_up_filter_time_limit

Integer

No

A relative time window (in seconds) for further restricting the alerts/Situations in the sweep_up_filter parameter. Default is 0 (no time limit).

first_match_only

Boolean

Yes

If enabled, events, alerts, and Situations only pass through actions on the first time they enter this workflow.

operations

JSON Array

Yes

List of properties relating to each operation:

Name

Type

Required

Description

type

String

Yes

Type of operation. Options are: 'action', 'decision' and 'delay'.

operation_name

String

Yes, for 'action' and 'decision' types.

Name of the operation.

function_name

String

Yes, for 'action' and 'decision' types.

Name of the function.

forwarding_behavior

String

No

function_args

JSON Object

No

Arguments for the function.

duration

Integer

Yes, for 'delay' type.

Length of time before the message goes to the next operation.

reset

Boolean

Yes, for 'delay' type.

Determines whether the timer resets after each occurrence. Not available if you have set a workflow to first_match_only.

The timer is reset only if an occurrence with the same ID is received (alert_id or situation_id) within the current 'delay' timeframe.

Examples

The following examples demonstrate typical use of method createWorkflow:

Request example

Example request to create a new workflow "ChangeInfoWorkflow":

var id = moogdb.createWorkflow(
{
    "moolet_name": "Alerts Workflows",
    "workflow_name": "ChangeInfoWorkflow",
    "description": "Changingthealertinformation",
    "entry_filter": "((category = \"Closed\") AND (custom_info.test = \"test\")) AND (description = \"test\")",
    "sweep_up_filter": "((sig_id = 1) AND (first_event_time = 1574121600)) AND (description = \"test\")",
    "first_match_only": false,
    "operations": [{
        "type": "action",
        "function_name": "functionA",
        "function_args": {"admin": 2},
        "operation_name": "do something"
         },
         {
             "type": "delay",
             "delay": 30,
             "reset": false
     }]
});