Dynamic Flow Variable
The dynamic flow variable is a special type of variable that gets shared between actions.
When ever there is a need for passing the variable to another action then use this.
Name (optional JSON Path) | This specifies the name of the variable. It can be either a static name that you choose or a dynamic name based on the response of the current action or a previous action. The "Behavior" field controls how this variable will behave, in conjunction with the "Name Property" field. |
Value (optional JSON Path) | This specifies the value of the variable. It can be either a static name that you choose or a dynamic name based on the response of the current action or a previous action. The "Behavior" field controls how this variable will behave |
Behaviour | Set:
Set foreach:
Append:
Append for each:
|
Example 1: Using Dynamic Flow Variables with a Fixed Name and SET:
Imagine you have a response from either the parent or the current action and want to set a variable. You could set up a Dynamic Flow Variable as follows:
Name: TheVariable
Value: $.path.to.value
Behavior: SET
In this case, the Dynamic Flow Variable TheVariable will take the value of $.path.to.value from the scope, overwriting the previous value if any. This is useful when you want to track only the latest value of a given response rather than accumulating values.
Example 2: Using Dynamic Flow Variables with JSON Path and APPEND:
Suppose you have a series of API calls in your workflow, and you want to accumulate a list of all the received responses in a variable called{" "} allResponses. You could set up a Dynamic Flow Variable as follows:
Name: allResponses
Value: {{ response.data } }
Behavior: APPEND
In this example, the Dynamic Flow Variable allResponses will gather the response bodies from each API call and append them to the existing value, creating a cumulative list.