# Set Assignee when Task is completed

**URL:** <https://forum.flowable.org/t/set-assignee-when-task-is-completed/3177>\
**Category:** Flowable Engine\
**Created:** [January 4, 2019, 10:48am UTC](https://forum.flowable.org/t/set-assignee-when-task-is-completed/3177 "2019-01-04T10:48:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![garyb](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@garyb](https://forum.flowable.org/u/garyb)\
**Post date:** [January 4, 2019, 10:48am UTC](https://forum.flowable.org/t/set-assignee-when-task-is-completed/3177/1 "2019-01-04T10:48:06Z")

</div>

For audit purposes we need to know who completed a task.  
What is the best way to enforce that a task has an assignee before it is completed?

I have tried using a TaskListener to set the assignee - triggered when the task is completed, but the assignee is null when I retrieve the HistoricTaskInstance. I wonder if the instance is completed before the listener updates the assignee? Shouldn’t all the listeners need to run before the flow is moved on?

---

<div class="post-metadata">

**Author:** ![maudrid](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@maudrid](https://forum.flowable.org/u/maudrid)\
**Post date:** [January 9, 2019, 2:42pm UTC](https://forum.flowable.org/t/set-assignee-when-task-is-completed/3177/2 "2019-01-09T14:42:45Z")

</div>

If you used a task listener, did you remember to call save() on the task?

---

<div class="post-metadata">

**Author:** ![garyb](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@garyb](https://forum.flowable.org/u/garyb)\
**Post date:** [January 9, 2019, 3:19pm UTC](https://forum.flowable.org/t/set-assignee-when-task-is-completed/3177/3 "2019-01-09T15:19:39Z")

</div>

No I didn’t - but it working well now.  
Thanks.
