1

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.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Changas
  • 11
  • 3
  • This is not an actual answer to your problem, but you could just hardcode the name into the log if your purpose is to know when the service started and when it ended. Lets say for example you have 2 services (S1 and S2) then you will need to log 4 times: log.info("S1 starting"); log.info("S1 ending"); log.info("S2 starting"); log.info("S2 ending"); – Bobe Kryant Feb 22 '17 at 09:22

3 Answers3

1

It may help you

tw.system.model.findServiceByName(serviceName)
Vojtech Ruzicka
  • 16,384
  • 15
  • 63
  • 66
vasu
  • 11
  • 1
  • Thank you for reply. But exactly what I need is to get a service name itself. For example I have Heritage Human Service called "Test_HS" and I have a server script in it called "Start" and what I need is a command to log the service name "Test_HS" to SystemOut.log once I am running "Start" server script. – Changas Dec 01 '16 at 07:19
1

Use:

tw.system.serviceFlow.name 
moderewer
  • 37
  • 8
0

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

Tukesh
  • 73
  • 7