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 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String | Yes | Name of the Workflow Engine Moolet that the new workflow belongs to. | ||||||||||||||||||||||||||||||||
| String | Yes | Name of the new workflow. Must be unique. | ||||||||||||||||||||||||||||||||
| String | No | Description of the new workflow. | ||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||
| Integer | No | A relative time window (in seconds) for further restricting the alerts/Situations in the | ||||||||||||||||||||||||||||||||
| Boolean | Yes | If enabled, events, alerts, and Situations only pass through actions on the first time they enter this workflow. | ||||||||||||||||||||||||||||||||
| JSON Array | Yes | List of properties relating to each operation:
|
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 }] });