How to change assignee on complete of task?

Hi, I am using camunda 7.17
and I have a case on my workflow that I want to reassign the task on complete to a variable

when the user complete task in Requester modify user task
I have a complete task listener as follows

and when the task is completed and reach department inbox user task,the assignee is never set

please advice.

Hi @devmsaleh,

Welcome to the community!

The “complete” event occurs just before the task is deleted and in your code, you are trying to set the assignee property of the task to be deleted.

If the goal is to set the assignee for the next task “Department Inbox” then simply set the assignee property of the “Department Inbox” task to a variable (“reservedBy” in your case)

1 Like

Thanks for clarifying, how to se the nextAssignee only if it is not null ?
because I don’t always want to set it
and when it is null i get the error :
Unknown property used in expression: ${nextAssignee }. Cause: Cannot resolve identifier 'nextAssignee ’

Then I believe you can use your logic but task listener should be attached to “Department Inbox” task and create event should be used

1 Like

I ended up adding a create task listener (on the new step)
and the script was :


and it worked just fine.

1 Like