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:

ADVERTENCIA: THREAD_ID=152 | HOSTNAME=spot-paola | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=4923720847159922385 | PROCESS_NAME=Servicios de Cobranza | PROCESS_VERSION=5.0 | PROCESS_INSTANCE_ID=4 | ROOT_PROCESS_INSTANCE_ID=4 | FLOW_NODE_DEFINITION_ID=-6281735113855170897 | FLOW_NODE_INSTANCE_ID=44 | FLOW_NODE_NAME=Validar trámite | CONNECTOR_DEFINITION_IMPLEMENTATION_CLASS_NAME=Obtener usuari | CONNECTOR_INSTANCE_ID=44 | Expression sSLA with content = <Funciones.EnvelopeUsuario(BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId().toString())> depends on apiAccessor is neither defined in the script nor in dependencies."

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?



Submitted by Sean McP on Sun, 12/28/2014 - 18:50

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.

1 answer


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


Submitted by epfalcon on Mon, 12/29/2014 - 19:15

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.