Workflow definition object

A Workflow Definition is represented by a JSON Object.

The operation of a workflow definition is specified by tasks, which are represented by JSON objects, fields in the top-level "tasks" object.

Here is an example workflow definition with one task named "Hello World".

{
  "name": "Hello World",
  "description": "A simple minimal example of a workflow definition",
  "startTask": "Hello World",
  "tasks": {
    "Hello World": {
      "type": "Simple",
      "end": true
    }
  }
}

When this workflow definition is started, the system begins execution by identifying the Start Task. It executes that task, and then checks to see if the task is marked as an end task (identified by "end": true). If it is, the workflow terminates and returns an output. If the task is not an end task, the system looks for a "nextTask" field to determine what task to run next; it repeats this process until it reaches a Terminal Task or a runtime error occurs.

In this example, the workflow contains a single task named "Hello World". Because "Hello World" is a Simple Task, the system schedules it until it is completed by a user or remote worker. Assuming the task completes successfully, the workflow will terminate successfully.

Workflow definition fields

Field

Type

Required

Description

name

String

Yes

The name of the workflow definition.

description

String

No

Human-readable description of the workflow.

startTask

String

Yes

Must exactly match one of names of the "tasks" fields. The system starts running the the workflow at the named task.

tasks

JSON Object

Yes

JSON Object represents the task definitions.

timeoutSeconds

Long

No

If provided, it provides the maximum number of seconds the workflow is allowed to run. If the workflow runs longer than the specified time, then the system fails the workflow with a TimedOut status.

No time outs if set to 0.

Default is 0.

failureWorkflow

Workflow Definition Id

No

Workflow to be run on current Workflow failure. Useful for cleanup or post actions on failure.

failureWorkflowVersion

Integer

No

Version of failure workflow definition to use.

maxConcurrency

Integer

No

An integer that provides an upper bound on how many workflows may run in parallel.

No limit if set to 0.

Task definitions object

Tasks are represented as fields of the top-level "tasks" object.

The task name, whose length must be less than or equal to 80 Unicode characters, is the field name; task names must be unique within the scope of the whole workflow definition.

The following task names are reserved:

Here is an example Simple task:

"Hello World": {
  "description": "Simple task to be executed by a user or SimWorkflow API",
  "type": "Simple",
  "nextTask": "Next Task"
}

Task definition fields

Many fields can appear in more than one task type. The table below summarizes which fields can appear in which tasks. It excludes fields that are specific to one task type.

Tasks

Simple

HTTP

JQ

Wait

Email

Map

Parallel

Decision

Terminate

type

Required

Required

Required

Required

Required

Required

Required

Required

Required

description

Optional

Optional

Optional

Optional

Optional

Optional

Optional

Optional

Optional

inputParameters

Optional

Optional

Optional

Optional

Optional

Optional

Optional

Optional

Optional

nextTask or end: true

Required

Required

Required

Required

Required

Required

Task input parameters

Task input parameters is a JSON fragment of key-value pairs containing the mapping values from input or output of another task during the execution. Parameters include data fields and attachments.

Here is an example of task input parameters:

"inputParameters": {
  "${...}": "${jsonata:$merge(*.output)}",
  "attachments": "${jsonata:$merge(*.attachments)}",
  "key": "SWF-${swf:sequenceNumber}"
}

The above example would:

In SimWorkflow, certain parameter name prefixes are reserved for specific purposes. Understanding these prefixes and syntax conventions is crucial for effective workflow design. Here's a breakdown of the reserved prefixes and syntax rules:

Reserved prefixes:

JSONPath expression syntax:

JSONata expression syntax:

Referencing workflow inputs:

Referencing task inputs and outputs:

Referencing task attachments:

Referencing workflow definition variables:

Examples of acceptable expressions:

Task definition types