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

Initializing complex variables and lists

In Process Designer, you must initialize all complex variables and all lists (arrays) before you can use them in a BPD or service.


Procedure

  1. In the Variables tab of your BPD or service diagram, declare a variable that is a complex business object or a list.

    For example, a variable named myVariable of type Requisition or a variable named myList that is a list of string variables.

  2. In the diagram area, drag a script task from the palette to the canvas.

  3. In the Implementation tab, initialize your variable using the a JavaScript text area:

    • If the variable is a complex object, use: tw.local.<variableName>=new tw.object.<businessObject>();.

      For example: tw.local.myVariable=new tw.object.Requisition();

    • If the variable is a list, use: tw.local.<listName>=new tw.object.listOf.<businessObject>();.

      For example: tw.local.myList=new tw.object.listOf.String();

    If your complex business object or list includes elements that are complex variables, they also must be initialized.


What to do next

You have initialized your complex variable or list. The variable can now store data.

Business objects and variables


Related tasks:
Declaring variables for a BPD or a service