Feedback

  • Contents
 

Variable Scope

You can use process variables anywhere in your process. However, you can also create local variables inside tasks, states, and work items. If you create a local variable, it is available only in the task, state, or work item where you created it. Like variable types in tasks, states, and work items can, however, use an input and output mechanism to pass values among those entities. (See Variable Accessibility.)

Process-level (global) variables are appropriate for values that must be shared by multiple different tasks, states, work items, and so forth. Variables whose values affect or reflect common or basic functionality of a process may be good candidates to keep together as a set of process variables.

Local variables are appropriate especially when a process has multiple tasks, states, or work items that:

  • Use similar values in similar ways, and

  • Use those variables in an isolated context, and do not share those values with other parts of the process.

  • Have direct and specific input/output parameters.

For example, your process might have several tasks, each of which gets a credit score from a different credit bureau. Each task could have a local variable to hold the raw credit score received from the credit bureau and might then do calculations with the score. By using local variables, each task could have its own variable named CreditScore that was only available inside the task. As a result, the meaning of the variable would be clear to anyone who looks at it, but the process wouldn't be confused by multiple variables having the same name. States and tasks may use process- and local-scoped variables, either exclusively or inclusively, as needed and appropriate to their intended function.

Note: When you use process variables in a work item, IPA makes copies of the variable values to use while the work item is running. If the work item updates the values, then IPA does not copy the updated values back to the process variables until the work item ends.

Related topic:

Variable Accessibility