1

I'm modeling a process at a given time and want to assign a User Task to the user who created the instance of the process.

What should I put in my User Task "Assignee" field?

Thank you in advance

3 Answers3

1

We solve this by setting a "startedBy" process variable on process start. Then, just use the variable value in the Assignee field: ${startedBy}.

You will have to modify your process start to get the logged in user. This can either be done by passing the variable to the "startProcessByKey" ... method or implementing a Listener on the start event that tries to get the user from the current session.

Jan Galinski
  • 11,768
  • 8
  • 54
  • 77
0

end listener on the start event works fine:

<camunda:executionListener expression="${execution.setVariable(&#39;startedBy&#39;, authenticatedUserId)}" event="end" />
David Buck
  • 3,752
  • 35
  • 31
  • 35
Igor Msk
  • 1
  • 1
0

We can set the process initiator through IdentityService.

public void test(){
    //start process
    identityService.setAuthenticatedUserId(userId);
    ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId);
    //query
    historyService.createHistoricProcessInstanceQuery().startedBy(userId).list()
}

casca
  • 21
  • 2