History not updated through script

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?

Hi @joram @filiphr
can you please comment on this

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");


Thanks filiphr.
Sorry for the tag.