IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Modeling processes > Business objects and variables
Declaring and passing variables
Variables capture the business data that is passed from step to step in a process.
The variables are local to a business process definition (BPD) or service. You cannot reference a variable from another business process definition or service. Variables contain the values or references to business data. To propagate the business data values and references, you must properly declare the variables and pass them to the linked processes, services, and message events.
When you use the Activity Wizard to create a service to implement an activity, you can pick the variables from the main BPD to use as input and output. When you do, the Activity Wizard automatically declares the variables for the resulting service and completes the data mapping for the activity.
You can use the Activity Wizard to create Human, Rule, and General System services.
The general procedure for passing variables is:
An alternative form of propagation is to define the variable type as a shared object when you create or edit your business object; that is, select the Shared Object check box. The values of a variable designated as a shared object are persisted to a data store. At each process, service or message event boundary, the local variables with the same shared object key are refreshed from the data store. See Create business objects for information about shared objects.
- Declare variables at the BPD level.
- For each linked process and service, declare variables and business objects to receive the values of the variables of the main BPD.
- Pass those variables as inputs to the linked processes and services that require them for their implementation.
- Pass the variables from the linked processes and services back up to the main BPD as outputs when you want the main BPD to be aware of changes made to the variables in the linked processes or services.
When passing variables from a process to a linked process, their types should be compatible.
For example, a string variable in a process can only be passed to a linked process if this linked process has a string variable declared as an input variable.
- How variables are passed in Process Designer
Using variables, business data in Process Designer is passed between processes and linked processes, between processes and services, and between services and services.- Declaring variables for a BPD or a service
For each business process definition (BPD) or service created, you must declare variables to capture the business data that activities in that BPD or steps in that service use.- Mapping input and output data for an activity or step
In Process Designer, to pass variables to an activity or a step you have to set the input and output data mapping.- Declaring variables for a subprocess
Subprocesses and event subprocesses can access the variables of the process they are contained in. They can also have their own variables that are only relevant within the context of the subprocess or event subprocess and any subprocesses or event subprocesses they might contain.- Testing declared variables and data mapping with coaches
When you declare and map variables in your BPD, you can test the mapping between activities by using coaches and running your BPD in the Inspector.
Business objects and variables
Related tasks:
Adding a Decision service to a process
Adding a JRules Decision Service component to a service
Visualize variables