Try OpenEdge Now
skip to main content
Application Developer's Guide
Developing applications with rollback support : Writing JavaScript code for rollback worksteps : Sample Javascript code

Sample Javascript code

In the following example, "jst" refers to JSTools class for execution of JavaScript codes. Users can invoke all getXXX() and setXXX() methods and also specialized tools such as sendEmail().
var name = jst.getDataSlotValue ("empName");
var salary = jst.getDataSlotValue ("empSalary");
jst.putDataSlot ("empName", name);
jst.putDataSlot ("empSalary", salary);
var adr = "";
var subject = "Testing";
var content = "CONTENT";
jst.sendEmail(adr, subject, content);
In the following example, "pak" refers to the entire BP Server API. All API calls must start invoking pak.connect(<username>, <password>) and end with pak.disConnect().
var session = pak.connect(<username>, <password>);
var ebmsVersion = pak.getPAKVersion(session);
In the following example, the keyword "Packages" invokes static Java methods.
package com.tdiinc;
public class Employee {
protected static String empName;
public static String getName () {
return empName;
JavaScript code
function f1() {
var name =;
return (name);
} f1()