Workflow Activities
Activities define the actions that should be taken when certain conditions are met within a workflow. They are executed in the order they are defined.
Activity Structure
Here's a typical example of an Activity section in YAML:
name: "Send Email to the customer"
conditions: # optional
- expression: "[Order.Status] = 'Pick Up'"
description: "Send Email to the customer"
variables: # activity variables
- name: "emailAddress"
value:
switch: "{{ environment }} }}"
cases:
"test": "[email protected]"
default: " {{ Order.Customer.Email }}"
steps:
- type: "Utilities/HttpRequest@1"
conditions: "[Order.Status] = 'Pick Up'"
inputs:
url: "https://example.com"
method: "POST"
body: '{"order": "{{Order}}"}'
- type: "Email/Send@1"
conditions: "[Order.Status] = 'Pick Up'"
inputs:
to: "{{ emailAddress }}"
template: "OrderConfirmation"
data: '{"order": "{{Order}}"}'
outputs:
- name: "response"
mapping: "{{ sendEmail.response }}"
- name: "statusCode"
mapping: "{{ sendEmail.statusCode }}"
Attributes
-
name
(required): The name of the activity. -
conditions
(optional): Specifies when the activity should be executed. If not present, the activity will always be executed.Structure:
conditions:
- expression: "[Order.Status] = 'Pick Up'" -
description
(optional): Provides a human-readable explanation of the activity. -
continueOnError
(optional): Specifies whether the workflow should continue if an error occurs during mapping. If not present, the workflow will stop if an error occurs during mapping. -
events
(optional): Specifies the events that should trigger this activity. If not present, the activity will be triggered by all events. -
steps
(required): Lists the actions that should be taken during this activity. Must have at least one action.Structure:
steps:
- task: "taskType@version"
conditions: "expression"
inputs:
key1: "value1"
key2: "value2"
key3": "{{value1}} {{value2}}" # combined input
outputs:
- name: "output1"
- name: "output2"-
task
: Specifies the type of action (e.g., "script", "webhook"). Version can be specified after the task name, separated by an@
symbol (e.g., "script@1"). Otherwise, the latest version will be used. -
condition
(optional): Determines when the action should be executed. If not present, the action will always be executed. -
inputs
: Additional information required for the action. -
outputs
: The outputs of the action. Outputs used to populate workflowvariables
field of the next action. If not present, the action will not have any outputs. Names of the outputs are used as keys in thevariables
field.
-