getWorkflows

A MoogDb v2 method that returns workflows for a Workflow Engine Moolet.

Back to MoogDb V2 API Method Reference.

Request arguments

Method getWorkflows takes the following request arguments:

Name

Type

Required

Description

mooletName

String

Yes

Name of the Workflow Engine Moolet to return workflows for.

activeOnly

Boolean

No

Return only active workflows.

Response

Method getWorkflows returns a JSON array of workflow objects. Each object has the following:

Name

Type

Description

id

Integer

Unique ID of the workflow.

moolet_name

String

Name of the Workflow Engine Moolet.

workflow_name

String

Name of the workflow.

description

String

Description of the workflow.

sequence

Integer

Sequence number of the workflow.

active

Boolean

Indicates whether or not the Moolet's associated Workflow Engine is active.

entry_filter

JSON Object

Filter in SQL-like or JSON format to determine which events, alerts, or Situations can enter the workflow. If empty, the workflow accepts all events, alerts or Situations.

sweep_up_filter

JSON Object

Filter in SQL-like or JSON format to intake any additional alerts or Situations from the database. Not relevant for event workflows.

first_match_only

Boolean

If enabled, alerts and Situations only pass through actions on the first time they enter the Workflow Engine. Not relevant for event workflows.

operations

JSON List

List of properties relating to each operation:

Name

Type

Description

type

String

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

operation_name

String

Name of the operation. Only relevant for 'action' and 'decision' types.

function_name

String

Name of the function. Only relevant for 'action' and 'decision' types.

function_args

JSON Object

Arguments for the function.

duration

Integer

Length of time before the message goes to the next operation. Only relevant for 'delay' type.

reset

Boolean

Determines whether the timer resets after each occurrence. Only relevant for 'delay' type.

Examples

The following examples demonstrate typical use of method getWorkflows:

Request example

Example request to workflows associated with the "Situation Workflows" Moolet:

var response = moogdb.getWorkflows("Situation Workflows");

Response example

Example response returning details of the workflows associated with the "Situation Workflows" Moolet:

[
  {
    "first_match_only": true,
    "sequence": 1,
    "operations": [
      {
        "duration": 120,
        "reset": false,
        "type": "delay"
      },
      {
        "operation_name": "Create Ticket",
        "function_name": "createServiceTicket",
        "forwarding_behavior": "always forward",
        "function_args": {
          "services": "ServiceNow, Remedy, Cherwell, Jira Service Desk, Jira Software"
        },
        "type": "action"
      }
    ],
    "moolet_name": "Situation Workflows",
    "workflow_name": "Automated Ticketing",
    "entry_filter": {
      "left": {
        "left": {
          "op": 0,
          "column": "sig_id",
          "type": "LEAF",
          "value": 1
        },
        "oper": "AND",
        "right": {
          "op": 4,
          "column": "delta_priority",
          "type": "LEAF",
          "value": 0
        },
        "type": "BRANCH"
      },
      "oper": "AND",
      "right": {
        "op": 0,
        "column": "category",
        "type": "LEAF",
        "value": "Closed"
      },
      "type": "BRANCH"
    },
    "active": false,
    "description": "You can optionally use this workflow if you use UI ticketing integrations. It creates tickets in the ticketing system as Situations are actioned.",
    "sweep_up_filter": {
      "left": {
        "op": 0,
        "column": "category",
        "type": "LEAF",
        "value": "Closed"
      },
      "oper": "AND",
      "right": {
        "op": 0,
        "column": "created_at",
        "type": "LEAF",
        "value": 1574121600
      },
      "type": "BRANCH"
    },
    "id": 1
  },
  {
    "first_match_only": false,
    "sequence": 2,
    "operations": [
      {
        "duration": 0,
        "reset": false,
        "type": "delay"
      },
      {
        "operation_name": "Stop Situation",
        "function_name": "stop",
        "forwarding_behavior": "Stop All Workflows",
        "type": "action"
      }
    ],
    "moolet_name": "Situation Workflows",
    "workflow_name": "Closed Situation Filter",
    "entry_filter": {
      "op": 0,
      "column": "status",
      "type": "LEAF",
      "value": 9
    },
    "active": true,
    "description": "You can optionally use this workflow to prevent closed Situations from processing.",
    "sweep_up_filter": null,
    "id": 4
  }
]