Skip to main content

Step reference

Every step is a StepData subclass. In JSON the @class field is the type discriminator (the fully-qualified class name); in Java you instantiate the class directly. All steps share two base fields:

FieldMeaning
nameStep name (unique within its container)
assignResultToVarOptional — variable that receives the step's result

String values support ${variable} substitution, and condition/assignment expressions support the built-in mini: language and any other registered scripting prefix (groovy:, javascript:, …).

Conditions need a language prefix

A condition must carry a language prefix, e.g. mini: score >= 90. A bare score >= 90 is not evaluated — the resolver returns the raw string, If treats it as false and Halt never halts. ${var} substitution alone is not enough for Halt either: it produces a string, and Halt only reacts to a real boolean true.


AssignVariables​

Sets one or more variables from literals or expressions.

{
"@class": "ai.mindconnect.workflow.domain.AssignVariablesData",
"name": "greet",
"assignResultToVar": "greeting",
"variableAssignments": [
{ "varName": "greeting", "expressionOrVarName": "Hello ${name}!" }
]
}
var step = new AssignVariablesData();
step.setName("greet");
step.getVariableAssignments()
.add(new VariableAssignment("greeting", "Hello ${name}!"));

Block​

Groups a list of steps; its result is the result of its last step.

{
"@class": "ai.mindconnect.workflow.domain.BlockData",
"name": "outer",
"steps": [
{ "@class": "ai.mindconnect.workflow.domain.AssignVariablesData", "name": "a",
"variableAssignments": [ { "varName": "x", "expressionOrVarName": "1" } ] }
]
}
var inner = new AssignVariablesData();
inner.setName("a");
inner.getVariableAssignments().add(new VariableAssignment("x", "1"));

var block = new BlockData();
block.setName("outer");
block.addSteps(inner);

If​

Branches on a condition. conditions is an array — the first condition that evaluates true wins (if/else-if) — and there is an optional elseBlock.

{
"@class": "ai.mindconnect.workflow.domain.IfData",
"name": "branch",
"conditions": [ { "condition": "mini: score >= 90",
"thenBlock": { "@class": "ai.mindconnect.workflow.domain.BlockData",
"name": "pass", "steps": [] } } ],
"elseBlock": { "@class": "ai.mindconnect.workflow.domain.BlockData",
"name": "fail", "steps": [] }
}
var then = new BlockData(); then.setName("pass");
var els = new BlockData(); els.setName("fail");

var cond = new IfData.Condition();
cond.setCondition("mini: score >= 90");
cond.setThenBlock(then);

var ifStep = new IfData();
ifStep.setName("branch");
ifStep.setConditions(cond);
ifStep.setElseBlock(els);

ForEach​

Iterates a collection. Set parallel to run iterations concurrently, and joinResults / joinDelimiter to collect the per-item results.

FieldMeaning
loopOverName of the variable holding the collection (a bare name like items, not ${items} — a ${…} expression stringifies the list and fails with "not iterable")
runVarVariable holding the current item
indexVarOptional — current index
parallelRun iterations concurrently
joinResults, joinDelimiterCollect/join the per-item results
resultFromOptional — expression/variable evaluated per iteration as that iteration's result
{
"@class": "ai.mindconnect.workflow.domain.ForEachData",
"name": "loop",
"loopOver": "items",
"runVar": "item",
"parallel": false,
"joinResults": true,
"joinDelimiter": ", ",
"steps": []
}
var loop = new ForEachData();
loop.setName("loop");
loop.setLoopOver("items");
loop.setRunVar("item");
loop.setJoinResults(true);
loop.setJoinDelimiter(", ");

Code​

Runs a script in a pluggable language (requires the matching mc-workflow-code-* module).

FieldMeaning
languagemini (built-in, no extra module), javascript (default), groovy, beanshell, jython
codeThe script source
injectVariables / exportVariablesBind workflow vars in/out (default true)
wrapInFunctionWrap the code in a function (default false)
{
"@class": "ai.mindconnect.workflow.domain.CodeData",
"name": "square",
"language": "javascript",
"code": "result = base * base;",
"assignResultToVar": "result"
}
var code = new CodeData();
code.setName("square");
code.setLanguage("javascript");
code.setCode("result = base * base;");
code.setAssignResultToVar("result");

HttpCall​

Makes an HTTP request and exposes the response.

FieldMeaning
url, methodRequest URL and method (default GET)
headersMap of request headers
body, contentTypeRequest body and its content type
failOnErrorThrow on non-2xx (default true)
timeoutMsRequest timeout (0 = use the client default)
statusCodeVar, responseHeadersVarVariables for status/headers
{
"@class": "ai.mindconnect.workflow.domain.HttpCallData",
"name": "fetch",
"url": "${apiBase}/hello",
"method": "GET",
"assignResultToVar": "response"
}
var http = new HttpCallData();
http.setName("fetch");
http.setUrl("${apiBase}/hello");
http.setMethod("GET");
http.setAssignResultToVar("response");

CallWorkflow​

Invokes another workflow by name, resolved from the WorkflowDefinitionRegistry configured on the context (without a registry the step throws). Use assignParams to feed parameters into the called workflow: key = param name in the child, value = variable name or expression in the current scope.

{
"@class": "ai.mindconnect.workflow.domain.CallWorkflowData",
"name": "delegate",
"workflow": "child-workflow",
"assignParams": { "name": "userName" },
"assignResultToVar": "childResult"
}
var call = new CallWorkflowData();
call.setName("delegate");
call.setWorkflow("child-workflow");
call.addAssignParam("name", "userName");
call.setAssignResultToVar("childResult");

JumpTo​

Jumps execution to another step by name — the building block for loops and gotos.

{ "@class": "ai.mindconnect.workflow.domain.JumpToData",
"name": "again", "jumpTo": "start" }
var jump = new JumpToData();
jump.setName("again");
jump.setJumpTo("start");

Halt​

Pauses or stops the workflow. Optionally conditional, and can return a result. A halted instance can later be resumed (see persistence).

FieldMeaning
conditionOptional — only halt if it evaluates true. Needs a language prefix (mini: needsApproval); a bare comparison or a ${…} substitution yields a string, and Halt only reacts to a real boolean true
returnResult, returnResultExpressionWhether/what to return on halt (returnResult defaults to true)
resumeParamsOptional Schema declaring the inputs expected when the workflow is resumed
nextStep to resume at
{
"@class": "ai.mindconnect.workflow.domain.HaltData",
"name": "wait-for-approval",
"condition": "mini: needsApproval",
"next": "after-approval"
}
var halt = new HaltData();
halt.setName("wait-for-approval");
halt.setCondition("mini: needsApproval");
halt.setNext("after-approval");

Need a step that isn't here? See Custom steps — you can add your own without touching the engine.