Variable managers allow you to store and retrieve data within workflows. There are three variable managers available in Flux: flow chart, action, and flow context.
Variables in the variable managers can be stored and retrieved using Runtime Data Mapping, and simple data types in the variable managers can also be easily accessed using Variable Substitution. Flow chart variables can be also be set during the creation of the workflow.
Variables in the flow chart variable manager can be stored, retrieved and updated from anywhere within the workflow. The flow chart variable manager should be used when a variable is needed in several places throughout the lifetime of a workflow. Flow chart variable values are stored to the database at each transaction break.
You can set flow chart variables when you create your workflow. Setting variables at the workflow creation time allows you to easily reuse values across your entire workflow while providing a single place to update the value when it needs changed. This is particularly useful when you are referencing the same values across several triggers or actions in a workflow (for example, you might create a flow chart variable to store the location of a mail server, then use Variable Substitution in your mail actions to reference that value).
Variables in an action's variable manager can only be accessed from the action itself. The action variable manager is typically only used internally within the action to store values that are vital to the action's execution. In most cases it is more appropriate to use the flow chart or flow context variable manager than the action's variable manager; generally speaking, you would only use this variable manager when writing a custom action (for more information on how the variable manager is used for custom actions, refer to the example code located in /examples/software_developers/custom_action under your Flux installation directory).
The flow context represents the flow of execution within the workflow. Variables stored or updated in the flow context variables can be accessed by subsequent triggers or actions within the same flow. Because the flow context represents the flow of execution at a particular instant in the workflow, it has a few advantages available over the flow chart variable manager: the special variable "RESULT" (which represents the result of the last action or trigger), and the ability to create transient variables (variables that are not persisted to the database).
Accessing Trigger and Action Results
Triggers and Actions that return results do so by storing the result value in the special flow context variable "RESULT". You can access this variable using normal techniques (Variable Substitution, or, for more complex data types, Runtime Data Mapping).
Users who are comfortable with the Flux API can also access the result value in code.
Transient variables are variables that are not stored in the database. Transient variables are useful when you have a significant amount of data (which can impact the performance of your workflow or engine when being stored to the database), the variable contains sensitive data that you do not want in the database, or the variable does not follow the Flux rules for persistence.
You can configure a trigger or action to return its result as a transient variable. You can also directly store transient variables in the flow context variable manager. Working with transient variables does require some comfort with using the Flux API; refer to the flow context API documentation for further instruction.