Creating the Instance Variable

You can store data about the instance in instance variables. We will define an instance variable of type ExpenseReport to store the expense report data in each instance.

Instance variables can be of any type, such as a string or a decimal, and there is no requirement that an instance variable be a BPM object. We use a BPM object here to keep things simple, as we only need to keep track of one variable and handle all of our information in one place. In a real-world process, you may or may not find this to be the best strategy, depending on your particular situation.

Note that while BPM object definitions are a part of the project, instance variables are defined for each process. If you had another process where you want to use the ExpenseReport object, you would have to define another instance variable for that process.

To create the instance variable:

  1. Make sure the Variables window is visible. It is usually on the right side of the screen. If it is not visible, click Window > Show View > Variables(Variables icon 
				). The Variables window has two sections: Project, for project variables, and Instance, for instance variables.
  2. In the Instance section of the Variables window, click on the Add icon (Add icon 
				). A variable entry is added to the instance variable list. This variable will have a default name, such as instanceVar1, and properties.
  3. Edit the Name property to report.
  4. Click on the Type property, and click on the Browse button (...). The Type dialog box appears.
  5. In the Type drop-down list, select <Component>. The Component section of the Type dialog box appears.
  6. Expand ExpenseManagement, then, Catalog, and then ExpenseComponents.
  7. Select ExpenseReport, and click OK. The variable type is changed to ExpenseReport.
  8. Still in the Variables window (see image below), right-click on the report instance variable, and click Map as process incoming argument (Map as Incoming Argument icon 
				). This allows the process to receive an expense report object (as created by the Create Expense Report global creation activity) into the report instance variable.
  9. Save your changes.

After completing this task, the Variables window should look like this:

Figure 1. Variables window with report instance variable

In the following task you will define a presentation to expose the BPM object to the users who will input the expense report.