i hope that you can help me with my problem.
I want to save the initiator of a process instance in a process variable.
My idea to get this is this:
I am using an external form as form key for my start event and a REST Call to start the instance.
I added an execution listener to this start event with the event type “end”. This listener starts a java class where i try to save the initiator with this code:
Authentication auth = execution.getProcessEngineServices().getIdentityService().getCurrentAuthentication(); String userId = auth.getUserId(); execution.setVariable("initiator", userId);
The execution listener is triggeed correctly.
With this code no instance is started, but without this code an instance is started.
So i guess something is wrong with getting the logged in user.
EDIT: I found out that execution.getProcessEngineServices().getIdentityService().getCurrentAuthentication(); is returning null.
So i know the problem. But i dont know how to solve it.
Do i have to enable anything for this to work?
Is there an alternative way to get the initiator?
Can anyone of you help me solving my problem? I you need further information please let me know.