Dynamic Variables are a special kind of Chain variable that can be set and change value during the execution of a Chain. In addition, the last set value of a Dynamic Variable is stored in OneCloud and can be used in a subsequent Chain run. This is very helpful when values need to be preserved from run to run.
Add a Dynamic Variable and Set the Initial Value
In the Chain properties, select the plus icon next to Dynamic Variables to add a new variable.
Once the new variable has been created, optionally set the initial value of the variable. Valid values include alphanumeric, special characters, and spaces. Once the Dynamic Variable is no longer needed, then simply use the “x” button on the right to remove the Dynamic Variable.
📓 If a variable is deleted
Any Command that uses a Dynamic Variable that has been deleted will see “Not Found” in a red oval.
Dynamically Set the Value During Runtime
Add a Set Dynamic Chain Variables Chain Event to set the value of the Dynamic Variable. After inserting the event, edit it, and use select the Dynamic Variable that should be the target of the new value. Once the target Dynamic Variable is selected, set the value that can either be static text or dynamically set from a command output such as a record count or the text from a list operation.
In the example below, the exact Chain Execution date and time is being set. The value of "DynVar1" can then be used in subsequent commands that all need to use the same date and time.
📓 Placement of the Set Dynamic Chain Variables
The placement of the event is important. Similar to Commands, you will only be able to set the value of your Dynamic Variable to the output of a Command that runs before the Chain event.
Skipping the execution of the Set Dynamic Chain Variables is possible by selecting the appropriate skip condition.
That’s it! Now the Chain will set the value of the Dynamic Variable with every run, if applicable, and it can be used by other Commands or events in the Chain as well.