IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Modeling processes > Business objects and variables > Declaring and passing variables

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.

If your subprocess uses business data that is also used in the top-level process or in other subprocesses or event subprocess under the same top-level parent, declare the variables in the top-level BPD. If the data is only used within the context of process execution, create these variables as private variables. If the data needs to be passed into or out of the process, create your variables as input or output variables in the top-level process. Data used only within the subprocess should be captured in private variables declared in the subprocess activity.


Procedure

  1. Expand your subprocess or event subprocess by double-clicking the activity in the parent BPD. The contents of your subprocess or event subprocess are visible in the editor.

  2. Go to the Variables tab. The input and output variables declared in the top-level process are visible, as are any private variables declared in the parent BPD. You can access these variables from within your subprocess or event subprocess, passing values between any subprocess activities that might require them.

    For example, if you are modeling the Get Customer Order subprocess of a larger Customer Order Handling process, you might need to access the Customer Account variable that is declared in the parent process.

  3. Create private variables for any data that is used only within the context of the subprocess or event subprocess and any subprocesses it contains.

    For example, the Get Customer Order subprocess might need to use a private variable used to authenticate the customer service representative onto the ordering system. This data is not needed outside of this part of the larger Customer Order Handling process, so it is a private variable within the subprocess only. In the Variables tab, click Add Private.

  4. Fill out the details of the new variable, including a name, data type, and description.

    Variable names declared in a subprocess or event subprocess cannot be the same as variable names declared in its parent process. If there are multiple layers of embedding, with subprocesses contained within other subprocesses, variable names must be unique throughout the entire subprocess hierarchy. In addition, if you specify a search alias to use for Business Data Search in Process Portal searches, this alias must be unique within the top-level process and across all subprocesses and event subprocesses under the same top-level parent. The new private variable is created. This variable is visible to the subprocess or event subprocess and any embedded subprocesses or event subprocesses, but is not accessible by the parent BPD.

  5. To capture information about your subprocess data at run time, you can enable automatic tracking of variable data for the subprocess.

    1. In the Variables tab, select the variable that you want to track.
    2. Under Performance Tracking, select the Track this Field check box.

    3. In the Tracking tab, ensure that Enable Autotracking is enabled for the subprocess. This setting is independent of the setting for the parent process. Therefore, disabling autotracking in the parent BPD does not disable autotracking in the subprocess or any subprocess contained within that subprocess.

    4. After enabling autotracking and specifying the variables to track, save the process and send your newly defined tracking requirements to the Business Performance Data Warehouse. From the IBM BPM main menu, select File > Update Tracking Definitions.


What to do next

Now that you have declared your private variables, activities within your subprocess or event subprocess can use these variables to capture business data. If you have activities inside your subprocess that are implemented by services, you will need to map the data required by these services, either manually through the Data Mapping tab, or using the Activity wizard.

Declaring and passing variables


Related concepts:
Variable scope in Process Designer


Related tasks:
Mapping input and output data for an activity or step