Bonita says apiAccessor is undefined
In my diagram I have several connectors where I call apiAccessor, on personal tasks, but in one of them I get this error:
This is a soap connector ON_ENTER where I get the user Id. My code is this:
What is the 'right' way to get the user who is about to perform a task? Why is apiAccessor not available on this connector, but available in previous tasks used in the same way?
You say About to perform a task...don't you mean who is Doing (Initiating) the task, future vs present tenses...
Sorry, but I use all three, who did, who is and who will so have to be on the ball here, my answer for Current is below.
This is how I get a full username,
String initiatorUserName = BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).firstName + " " + BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).lastName;
You should be able to work from there.
One thing I noticed in my problem was....
Check everything...I had one letter misspelt in this connector and buggered if I know...took 8 hours and a lot of heartache. The Bonita Eclipse editor seems to be crippled in noticing many things. I wish they (Bonita) would update it or fix the issues, doesn't recognise spelling mistakes in class names, no find/replace, no CNTRL+> to word etc.etc. etc.
hope this helps regards
My team and I noticed that using a saved connector caused this issue. The issue itself seems to be that after loading a connector, and keeping the scripts untouched (even if it's perfectly fine code, tested already) caused the error. The solution is: move something on the code. I usually just hit Enter at the start of the groovy script with the envelope (on SOAP connector), and that ended the problem.