Camunda message start event set assignee with REST

When i start a process using a message start event, can i assign an assignee with the message?

Hey @humour! :slight_smile:
So when you start a process by using a message start event you can also include some process variables within the body of the message.
Doing so you can add a variable containing a specific assignee or candidate group. Just make sure that you put the variable-name, containing the assignee, in the corresponding field in a User Task as well.

Let me know if this works out for you!
Best,
Thomas

Hi and thank you for your response. Unfortunately it dont, it sets a variable as expected but the following task it not assigned to anyone.

Thanks for the fast reply @humour :slight_smile:
Does your user task look something like this?

And your message to start the process with like this:

{"messageName" : "aMessage",
"businessKey" : "aBusinessKey",
"processVariables" : {
    "aVariable" : {"value" : "aNewValue", "type": "String"},
...
    **"assignee_variable" : {"Jonathan"}**
}
}
1 Like

I tried it but unfortunately it failed. i put “assignee_variable” into that field and the task is assigned to “assignee_variable” at the end. And a process variable “assignee_variable” is created additionally.

Edit i tried to add an “Create” task listener (inline JS) on the next task and put in

task.setAssignee(task.getVariable("assignee_variable"));

then it works, thank you for leading the direction.

1 Like