AnsweredAssumed Answered

Get process's initiator username from Java class

Question asked by jsalvador on Sep 5, 2016
Latest reply on Sep 8, 2016 by jsalvador
Hi folks!

I'm using Activiti with Alfresco Community (currently AC 5.1). I'm working in some workflows, and few of them have an userTask that needs to be assigneed to an especific user, taked from a database.

Example: some users need their tasks must be approved by User A, and some users need their tasks must be approved by User B. This is defined by a database (with users and assigneed reviewers).

I have a Java class into a ServiceTask, that calls a JDBC service and get reviewer for each user, but the query needs the initiator username to take it properly. Is there any way to get the initiator's username?

At this moment, I tried with this code, but I get
null
.


    String initiator = execution.getVariable("initiator.properties.userName");


(Just like
${initiator.properties.userName}
used into User Task elements)

Thanks!

Outcomes