Return
Overview
Return step (previously Stop step) allows to stop the flow execution based on the condition provided while allowing to set the document value to any of its properties. If the condition provided evaluates to true, then the flow execution is stopped and the result is returned.
Configuration
Result Path
- Sets the doc as the value of specified document property. If not specified, it does not alter the doc.
Sample step configuration
tags: []
sampleInputSchema: ""
sampleData: {}
description: ""
steps:
- name: Step stop
description: ""
stepType: stop
condition: ""
config:
returnResult: docPropPath
Example Flow
Return condition true
In this example Return step condition evaluates to true
, flow is stopped and second step is NOT executed. Here we are setting the Result path
as docPathToReturn
so it sets doc value to {"key" :"value"}.
returnStepExample
tags: []
sampleInputSchema: ""
sampleData:
docPathToReturn:
key: value
otherDocProperties:
otherKey: otherValue
description: ""
baseFlow: null
steps:
- name: Step stop
description: ""
stepType: stop
condition: ""
config:
returnResult: docPathToReturn
- name: Step code
description: ""
stepType: code
condition: ""
config:
codeBlock: |-
const prop = {"additionalKey":"additionalValue" };
prop;
targetPath: additonalProp
Flow input
{
"docPathToReturn": {
"key": "value"
},
"otherDocProperties": {
"otherKey": "otherValue"
}
}
Flow Result
{
"doc": {
"key": "value"
},
"errors": [],
"performance": {
"steps": [
{
"step": "stop",
"executionTime": 8
}
],
"executionTimeOfFlow": 8,
"timeMetric": "ms"
},
"files": []
}
Return condition false
In this example Return step condition evaluates to false
, flow is not stopped and second step is executed. Here since condition evaluates to false it does not alter doc property in Return step.
returnStepExample
tags: []
sampleInputSchema: ""
sampleData:
docPathToReturn:
key: value
otherDocProperties:
otherKey: otherValue
description: ""
baseFlow: null
steps:
- name: Step stop
description: ""
stepType: stop
condition: "{{false}}"
config:
returnResult: docPathToReturn
- name: Step code
description: ""
stepType: code
condition: ""
config:
codeBlock: |-
const prop = {"additionalKey":"additionalValue" };
prop;
targetPath: additonalProp
Flow input
{
"docPathToReturn": {
"key": "value"
},
"otherDocProperties": {
"otherKey": "otherValue"
}
}
Flow Result
{
"doc": {
"docPathToReturn": {
"key": "value"
},
"otherDocProperties": {
"otherKey": "otherValue"
},
"additonalProp": {
"additionalKey": "additionalValue"
}
},
"errors": [
{
"warning": "Warning in flow 'newFlow085836' : Skipping step 'stop' in flow 'newFlow085836' because conditional result returned false"
}
],
"performance": {
"steps": [
{
"step": "code",
"executionTime": 12
}
],
"executionTimeOfFlow": 21,
"timeMetric": "ms"
},
"files": []
}