Skip to content

Why do some modern JavaScript features (like `findIndex()`, `let`, and `const`) fail or behave unexpectedly inside a workflow script task, while older equivalents like `indexOf()` and `var` work fine?

Answer

Workflow/BPA script tasks run on Camunda's underlying JavaScript engine (Nashorn, tied to the Java version in use), which fully supports ECMAScript 5.1 but only partially supports ECMAScript 6 — features like proper let/const block scoping, native Promises, and JS modules aren't fully supported, which is why some ES6-era methods and syntax either fail outright or behave inconsistently; stick to ES5.1-era JavaScript syntax and built-in methods (like indexOf() instead of includes()/findIndex(), and var instead of let/const) for reliable script-task behavior.

← Browse Workflows and automation questions