I want my first task to be assigned to the user starting the process ( ${initiator} ).
Is it possible without an additional task in between the start process and the first user task?
Instead of using the startUserId of the HistoricProcessInstance (which is not persistent yet when you try to query for it), you could use the methods IdentityService#getCurrentAuthentication and Authentication#getUserId to determine the start user. That is exactly the way the startUserId is populated anway.
On the start event you can fill in the property “Initiator” and by this provide the name of a variable in which the id of the user who started the process is stored. You would then reference that in the usertask.
@DanielMeyer What does the Initiator extension do? Because we just keep using the self-defined variable name, why is the initiator extension used? (I mean what does providing the varName in the initiator extension do behind the scenes?)
camunda:initiator just defines a process variable with the name varName to keep the userID of the logged in user who started the process instance from the tasklist-start-process-page (or from an authenticated rest call). And the engine fills the value.
@Ingo_Richtsmeier the example i am looking at is something like if you start a process through the API. You can send a variable as part of the start process API call to represent your “initiator”. Defining the initiator as a start event extension is not necessarily needed. I guess I am asking what does defining which variable name is used to represent he initiator as part of a start event extension actually do? Is this for the purposes the Model API?
ya looks like a helper specifically for tasklist ?
Because if I read this correctly, if you were starting a process through the API and there is no auth user, then authenticatedUserId would be sort of irrelevant. ?