How to retrieve current service name in Server Script item on IBM BPM 8.5.6

1.2k Views Asked by At

I would like to log once entering and leaving particular service, but I do not find the way to retrieve current service name in Server Script item on IBM BPM 8.5.6.

3

There are 3 best solutions below

0
On

Below is what you are looking for, but beware that invoking underlying packages are highly discouraged by IBM and IBM Support team. These may change at anytime without any notice.

var cont = Packages.com.lombardisoftware.core.script.js.JavaScriptRunner.getThreadsCurrentRunner().getJSExecutionContext();
var currentProcess = cont.getCurrentProcess();
var currentProcessItem = currentProcess.getItemById(cont.getCurrentProcessItemId());

log.info("currentProcess.getName(): " + currentProcess.getName());
log.info("currentProcessItem.getName(): " + currentProcessItem.getName());

Currently there is RFE at below link raised with IBM to provide JS interface for getting current service, but IBM have no plan to provide this API in near future, so need all of us to upvote it to make it heppen soon:-

http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=47099

1
On

It may help you

tw.system.model.findServiceByName(serviceName)
0
On

Use:

tw.system.serviceFlow.name