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

Use JavaScript variables and objects

You can use JavaScript in many components in Process Designer in order to improve the behavior of your model.

For example, you can write JavaScript to implement a step in your process and embed that script in an activity.

Process Designer provides a number of JavaScript methods and variables to customize your BPDs and to interact with:

All the variables you declare in Process Designer are JavaScript variables. You can use them inside service definitions and also in expression evaluations inside JavaScript code snippets.

While Process Designer supports using JavaScript to implement an activity, in most cases it is best to create a service that includes a server script component and then use the service to implement the activity.


Procedure

  1. Declare your BPD-level variables through the graphic interface.

  2. Click to select an activity in the BPD diagram or a server script component in a service.

  3. Click the Implementation tab in the properties.

  4. If you selected an activity, in the Implementation section, select JavaScript from the drop-down list.
  5. Type your JavaScript code in the Script text box.


Results

Your code is run when you run your process.


What to do next

If you want to reuse your code, you can write your code in an external JavaScript file and import it as an external library.

Business objects and variables


Related concepts:
Manage external files