Try OpenEdge Now
skip to main content
BP Server Developer's Guide
Workstep template management : Working with workstep template states : Using compensatory JavaScript code

Using compensatory JavaScript code

Using the compensatory enabled process gives you an opportunity to write compensatory JavaScript code to handle a rollback request. For example, write JavaScript in a process template using rollback points for the following cases:
*Send messages or e-mail notifications before running pre- and post-functions for a second time or for restoring the process effects regarding these functions.
*Send e-mail notifications to a computer on which an asynchronous nested process is running.
*Actions applied for rollback to a loop.
Compensatory JavaScript also works as pre- and post-functions for worksteps and cleans up all the activities completed by this workstep, such as deleting generated files, or removing new database entries.
Compensatory JavaScript is executed only if a rollback is requested by a user, or by the BP Server via a workstep's execution failure.
*public void setCompJavaScript(java.lang.String compJavaScript)
Sets the compensatory JavaScript code related to this workstep.
*public String getCompJavaScript()
Helps in retrieving the compensatory JavaScript related to this workstep.