Try OpenEdge Now
skip to main content
Application Developer's Guide
Developing an application : Using JavaScript in a workstep
 

Using JavaScript in a workstep

Note: Interfaces using JavaScript are developed through OpenEdge BPM Designer only.
For worksteps, you can create customized business logic using JavaScript. Enter and modify JavaScript code in BPM Designer under the Advanced tab in the workstep Properties view. Here you can define logic for a workstep before activation, upon activation, when completed, when overdue, upon an error and upon recovery, as desired. For more information about using BPM Designer, refer to OpenEdge Getting Started: Developing BPM Applications with Developer Studio.
Business Process Server executes the scripts you specify in the Before activation section at the start of the workstep, but after executing the precondition. The scripts you specify in the When completed section are executed at the completion of the workstep. You can also use the AutoComplete feature to automatically add scripts in these two sections. For more information, refer to "Adding Script to a Workstep" section of the OpenEdge Getting Started: Developing BPM Applications with Developer Studio.
The compensatory script is executed if that workstep is involved in a rollback process. For more information about using compensatory script in an application, see Writing compensatory JavaScript code (optional).
Using JavaScript in a workstep, you can:
*Manipulate dataslots in a workstep without having to write an adapter.
*Send an e-mail message in any workstep without creating a separate workstep.
*Use JavaScript’s regular expressions, pattern matching, and searching capabilities, in addition to using the Math library to perform calculations on dataslot values.
When you save the process template, it compiles the JavaScript code and rejects all code for which the compilation failed. All JavaScript code associated with the process template is then compiled again using the maximum optimization level when the process template is created in the BP Server. This compiled object is saved with the template workstep for faster execution of the JavaScript. If, however, any of the JavaScript compilation failed, then the creation of the process template is aborted and an exception is sent to the client.
* Integrating JavaScript
* Debugging the JavaScript code using writeLog