Try OpenEdge Now
skip to main content
Developing BPM Applications with Developer Studio
Setting workstep properties : Adding script to a workstep
 

Adding script to a workstep

You can use script to add customized business logic into worksteps in processes. Adding Java or JavaScript (for Business Processes) or Java (for Web applications) to a workstep enables you to accomplish a wide range of activities, including:
*Executing rules as an Adapter workstep, without having to write a Java program.
*Manipulating dataslots within a workstep, without having to write an adapter.
*Performing a Script’s regular expressions, searching function and pattern matches, as well as using its Math Library feature, to run complex calculations on dataslot values.
In Business Processes, you can use Java or JavaScript to add customized business logic to Start, Activity, Adapter, Subprocess, and Message worksteps. In Web applications, you must use Java to add customized business logic into all these worksteps, except Message (which is not supported). Each of these worksteps include an Execute script function in their respective Properties view. From the Advanced tab of the respective workstep’s Properties view, use the following supported tabs to define the action scripts.
Table 49. Script Tabs
Tab Name
Purpose
Supported worksteps (Business Process)
Supported worksteps (Web)
Before Activation
Executes the script before the workstep is started, but after the precondition is executed.
Activity, Adapter, Subprocess, and Message
Start, Activity, Adapter, and Subprocess
When Completed
Executes the script after the workstep is completed.
Start, Activity, Adapter, Subprocess, and Message
Start, Activity, Adapter, and Subprocess
Overdue Actions (Scripts tab in Overdue Actions)
Executes the script when an action is overdue.
Activity, Adapter, and Subprocess
Not supported
On Recovery
Executes the script after a rollback has recovered the specified data. See Chapter 10 of the Application Developer’s Guide for information regarding rollback process.
Activity, Adapter, Subprocess, and Message
Not supported
Note: BPM Designer automatically converts any previous BP Server/BPM Webflow expressions to the current Java-style expressions.
To add Script to a workstep:
1. Open a workstep’s Properties view, and click the Advanced tab.
2. From the Advanced tab, click the appropriate tab wherein you want to add the script.
3. You can use the Execute script box to define the script. Click Add Script. The Graphical Event Logic (GEL) tool appears with the defined event. You can use this tool to configure the action to be executed. For more information, see Using the GEL tool in BPM projects.
Note: For detailed information on using JavaScript and for JavaScript examples, see “Using JavaScript in a Workstep” section of the Application Developer’s Guide.