You can pass runtime arguments in a workflow execution request and access those arguments using workflow variables.
Set up a workflow that receives runtime arguments
To set up a workflow to receive runtime arguments that you pass to it as part of an execution request, do the following:
Follow the steps to create a new workflow, or choose an existing workflow to update, but don't deploy it yet.
Add a
paramsfield to the main workflow's definition. Ensure that the argument name is placed inside square brackets, and that the main workflow is placed in amainblock:YAML
main: params: [ARG_NAME] steps: ...
JSON
{ "main": { "params": ["ARG_NAME"], "steps": [ ... ] ... } }
The
mainblock accepts a single argument that is the name of any valid JSON data type; for example, an array, an object, or a string.As a best practice, passing in an object with multiple, named arguments makes it easier to understand their purpose, and to add arguments. You can also then use dot notation to access the arguments.
Other subworkflows can have multiple arguments.
For example, the following workflow returns a "Hello" greeting to a person whose first and last name you pass as runtime arguments:
YAML
main: params: [args] steps: - step1: assign: - outputVar: ${"Hello, " + args.firstName + " " + args.lastName + "!"} - step2: return: ${outputVar}
JSON
{ "main": { "params": [ "args" ], "steps": [ { "step1": { "assign": [ { "outputVar": "${\"Hello \" + args.firstName + \" \" + args.lastName}" } ] } }, { "step2": { "return":