Flows can execute script code when they reach the top of the flow stack or when they are dropped off the flow stack. The flow scripts have access to both the global and flow variables (whereas the global On-top and On-drop scripts can only access global variables).
To find the scripts, open a flow, click the 'Flows' tab and select 'Scripts'.
The On-top script of a flow will be executed whenever the particular flow becomes the top flow on the flow stack (either by being triggered or by regaining the top position after being interrupted by the triggering of another flow).
The On-drop script of a flow will be executed when the flow has finished and is about to be dropped from the flow stack. It is commonly used to copy the value of a flow variable to a global variable with a limited life span:
// Save flow variable coffeeSuggestion in global variable coffeeTypeInFocus coffeeTypeInFocus = coffeeSuggestion // Set the lifespan of the global variable _.setSessVarLifespan('coffeeTypeInFocus',2)
The On-top and On-drop scripts are executed when the a reached the top of the flow stack or when it is dropped off the flow stack. You may, however, want to execute a script at a specific point in a flow. In that case, you can use a Script node. If it's a script you need to execute regularly in different flows, you can consider storing it in an Integration.
Was this page helpful?