# Execution Object Sporadically Undefined in Script Task

**URL:** <https://forum.flowable.org/t/execution-object-sporadically-undefined-in-script-task/1828>\
**Category:** Uncategorized\
**Created:** [April 4, 2018, 8:20am UTC](https://forum.flowable.org/t/execution-object-sporadically-undefined-in-script-task/1828 "2018-04-04T08:20:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VasilTsimashchuk](https://avatars.discourse-cdn.com/v4/letter/v/ed655f/32.png) [@VasilTsimashchuk](https://forum.flowable.org/u/VasilTsimashchuk)\
**Post date:** [April 4, 2018, 8:20am UTC](https://forum.flowable.org/t/execution-object-sporadically-undefined-in-script-task/1828/1 "2018-04-04T08:20:09Z")

</div>

Dear Flowable experts,

In some of our tests, we create script tasks using the following logic:

```
ScriptTask scriptTask = new ScriptTask();
scriptTask.setName("Script Task for result creation");
scriptTask.setId(SCRIPT_TASK_ID);
scriptTask.setScriptFormat("javascript");
scriptTask.setScript("execution.setVariable('result',true);");
scriptTask.setAsynchronous(async);
process.addFlowElement(scriptTask);

```

Most of the times, it works totally fine. However, every once in a while some of the tests fail and the root cause for the failure is as follows: `"execution" is not defined in <eval> at line number 1`

Looks like the execution object has not been initialized. What could be a reason for this?

Thank you!

Best,  
Vasil
