# History not updated through script

**URL:** <https://forum.flowable.org/t/history-not-updated-through-script/7219>\
**Category:** Flowable Engine\
**Created:** [December 15, 2020, 10:23am UTC](https://forum.flowable.org/t/history-not-updated-through-script/7219 "2020-12-15T10:23:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamshichanda](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@vamshichanda](https://forum.flowable.org/u/vamshichanda)\
**Post date:** [December 15, 2020, 10:23am UTC](https://forum.flowable.org/t/history-not-updated-through-script/7219/1 "2020-12-15T10:23:32Z")

</div>

Hi,  
I configured a ScriptTaskListener to the userTask. I used,  
Language: javascript  
Script: task.setAssignee(“user”);

When the listener is executed, the assignee of the task is updated to user in runtime. But in the historic task instance, the assignee is not updated. Similar behavior is happening when expression is used for the task. Is this expected? or a bug? How can we resolve this?

---

<div class="post-metadata">

**Author:** ![vamshichanda](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@vamshichanda](https://forum.flowable.org/u/vamshichanda)\
**Post date:** [December 17, 2020, 5:33am UTC](https://forum.flowable.org/t/history-not-updated-through-script/7219/2 "2020-12-17T05:33:46Z")

</div>

Hi @joram @filiphr  
can you please comment on this

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [December 23, 2020, 9:48am UTC](https://forum.flowable.org/t/history-not-updated-through-script/7219/3 "2020-12-23T09:48:07Z")

</div>

Hey @vamshichanda,

You don’t need to tag us to get an answer. We are monitoring the forum and reply here without that.

Yes using the `task.setAssignee` will only update the runtime user and not the historic task instance. In order to correctly do the update you should use the `TaskService#setAssignee` instead.

e.g. in your expression you can use `taskServiceBean.setAssignee(task.id, "user");`

Cheers,  
Filip

---

<div class="post-metadata">

**Author:** ![vamshichanda](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@vamshichanda](https://forum.flowable.org/u/vamshichanda)\
**Post date:** [December 23, 2020, 10:13am UTC](https://forum.flowable.org/t/history-not-updated-through-script/7219/4 "2020-12-23T10:13:07Z")

</div>

Thanks filiphr.  
Sorry for the tag.
