Hi
You have first to persist your case. Just use the [Case Map feature][1] or create a task switch before your script step or set "persist task on creation" and first "Only WF users" in the start request under Workflow Mode:request:
![Persist task on creation][2]
[1]: https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.processmodeling.html#ivy-casemap
[2]: https://answers.axonivy.com/upfiles/Screenshot_20181119_143849_AKIIH1e.png