This section describes how to debug your JavaScript code and restart suspended worksteps.
You can use the writeLog method to print the value of JavaScript variables, or any other information, to help you debug your JavaScript code.
Note: As JavaScript writeLog() enables logging messages in debug mode only, do not write messages into bizlogic.log until you set the BP Server log level to debug.
The following is an example of how to use the writeLog method:
var name = jst.getDataSlotValue("empName");
var salary = jst.getDataSlotValue("empSalary");
jst.writeLog("DS empName+empSalary are read from server : " +
name + ":" + salary);
jst.putDataSlot("empName", name);
jst.writeLog("update DS empName is ok");
jst.putDataSlot("empSalary", salary);
jst.writeLog("update DS empSalary is ok");
The writeLog method attaches the process instance and workstep names as a prefix for each message printed in the log file, as shown below:
JSCRIPT:processInstanceName->workstepName:<msg>
For example, output in the bpserver.log file would look similar to the following:
JSCRIPT:h2#563->ArrangeInterview: update DS empName is ok.
You can use this to identify the messages when you have JavaScript code operating in multiple worksteps and processes at the same time. Remember to remove these statements when you have finished debugging your code.