Reference
StepFlow
State Types

State Types

StepFlow supports 8 state types for building workflows.

Task

Executes an action (HTTP call, function invocation, connector operation).

{
  "type": "task",
  "action": "trn:openact:default:action/http/api-call:execute",
  "mode": "sync",
  "parameters": {
    "url": "{% input.apiUrl %}",
    "method": "POST",
    "body": "{% input.payload %}"
  },
  "timeoutSeconds": 30,
  "retry": [...],
  "catch": [...],
  "set": {
    "apiResult": "{% result %}"
  },
  "output": {
    "data": "{% result.body %}"
  },
  "next": "NextStep"
}
FieldTypeDescription
actionstringTRN of the action to execute
modestringExecution mode: sync (default), async, callback
parametersobjectInput parameters (supports JSONata)
timeoutSecondsintegerStep timeout
credentialsobjectCredential reference
retryarrayRetry policies
catcharrayError catch policies

Set

Sets workflow variables without executing an action.

{
  "type": "set",
  "set": {
    "userId": "{% input.user.id %}",
    "timestamp": "{% $now() %}"
  },
  "output": {
    "processedAt": "{% $timestamp %}"
  },
  "next": "NextStep"
}

Use set to:

  • Extract and store data from previous steps
  • Initialize variables
  • Transform data between steps

Wait

Pauses execution for a duration or until a timestamp.

{
  "type": "wait",
  "seconds": 60,
  "next": "NextStep"
}
{
  "type": "wait",
  "timestamp": "{% input.scheduledTime %}",
  "next": "NextStep"
}
FieldTypeDescription
secondsinteger/expressionWait duration in seconds
timestampstring/expressionISO 8601 timestamp to wait until

Router

Conditional branching based on expressions.

{
  "type": "router",
  "routes": [
    {
      "condition": "{% input.status = 'approved' %}",
      "next": "ProcessApproved"
    },
    {
      "condition": "{% input.status = 'rejected' %}",
      "next": "ProcessRejected"
    }
  ],
  "default": "HandleUnknown"
}
FieldTypeDescription
routesarrayOrdered list of condition → next pairs
defaultstringFallback step if no condition matches

Routes are evaluated in order; first match wins.


Parallel

Executes multiple branches concurrently.

{
  "type": "parallel",
  "branches": [
    {
      "entry": "BranchA_Start",
      "steps": {
        "BranchA_Start": { "type": "task", ... , "end": true }
      }
    },
    {
      "entry": "BranchB_Start",
      "steps": {
        "BranchB_Start": { "type": "task", ... , "end": true }
      }
    }
  ],
  "maxConcurrency": 5,
  "next": "AggregateResults"
}
FieldTypeDescription
branchesarrayList of branch definitions
maxConcurrencyintegerMax concurrent branches

Output is an array of branch results in order.


Map

Iterates over an array, processing each item.

{
  "type": "map",
  "items": "{% input.orders %}",
  "maxConcurrency": 10,
  "toleratedFailureCount": 2,
  "itemProcessor": {
    "entry": "ProcessItem",
    "steps": {
      "ProcessItem": {
        "type": "task",
        "action": "...",
        "parameters": {
          "orderId": "{% input.id %}",
          "amount": "{% input.amount %}"
        },
        "end": true
      }
    }
  },
  "next": "Aggregate"
}
FieldTypeDescription
itemsexpressionJSONata expression returning an array
itemProcessorobjectWorkflow to run for each item
maxConcurrencyintegerMax concurrent iterations
toleratedFailureCountintegerAllowed failures before map fails
toleratedFailurePercentagenumberAllowed failure percentage

Important: Inside itemProcessor, input refers to the current item, not the parent input. Use $vars to access parent data.


Succeed

Marks successful workflow completion.

{
  "type": "succeed",
  "output": {
    "status": "completed",
    "result": "{% input.finalData %}"
  }
}

Fail

Marks workflow failure with error details.

{
  "type": "fail",
  "error": "ValidationError",
  "cause": "{% 'Invalid input: ' & input.errorMessage %}"
}
FieldTypeDescription
errorstring/expressionError code or name
causestring/expressionDetailed error message