The triggers and actions of a workflow may require specific data to be able to run properly. For example, a series of actions that use a database might all need access to the same database URL and table name. In such cases, it is often useful to store this shared data using flow chart variables so it can be easily referenced throughout the workflow.
Any variable that is stored in the database (such as a flow chart variable) is called a "persistent variable". Flux automatically stores and retrieves flow chart variables as they are needed by triggers and actions.
For more information on how variables can be created, stored, and retrieved, see Variable Managers.
Rules for Persistent Variables
To store a variable in the database, it must conform to the following rules (these rules are listed in the order in which Flux applies them). If your persistent variable does not follow these rules, Flux will encounter an error and the variable will not be persisted to the database (and, if the variable that caused the error is used in a workflow, the workflow itself may encounter an error).
- Your variable can be any of the following basic data types (or an instance of the listed Java class). Note that "serialized data" refers to any instance of a class that implements java.io.Serializable.
- serialized data
- Your persistent variable may be a Java collection from the java.util package (including List, Map, Set, SortedMap, or SortedSet). However, each item stored in the collection must also follow the rules for persistent variables (in effect, the rules are applied recursively to each item in the collection).
- Your persistent variable may be an array. If the variable is an array type that is not explicitly mentioned in rule #1, it will be treated as a List and must therefore follow the same rules as other collections (see rule #2 above).
- Your persistent variable may be a complex user-defined type. In this case, rules for persistence are applied recursively to each field on the variable, so any fields used in the custom variable must also follow the rules for persistence.
Because Flux variables are persisted in the database as XML, they do not support circular references (ObjectA contains ObjectB, which contains ObjectA, etc.).
If your variable contains a circular reference you may see an error like: