Script Tasks
A script task is a step in a business process that the engine executes automatically by running a script. Script tasks are useful for transforming data, computing values, and preparing variables for downstream steps.
The guided side panel for a script task provides a code editor with syntax highlighting and a browser-based preview runner.
Writing a script
Open the Script IDE from the script task’s side panel. The editor provides syntax highlighting and a free-form code area where you write JavaScript.
Scripts can read and write process variables. A common use is to prepare input values for a subsequent service task or to format data captured by a user task.
Testing with the preview runner
The editor includes a Run button that executes the script immediately and shows the result.
| The preview runs in the browser. It is a client-side approximation that uses the browser’s own JavaScript runtime. A script that previews successfully is not guaranteed to behave the same way when the engine executes it at runtime, and a script that fails in the preview may still work in production. |
Scripts that depend on data or services available only on the server will not work in the preview, even though they run correctly in the engine.
Use the preview to catch syntax errors and verify basic logic. Do not rely on it as proof that a script will run identically in the engine.
Variables in scripts
Scripts access process variables by name. To test a script in the preview, you can manually enter mock variable values in the preview panel — these stand in for the real process variables that would be available at runtime.
What happens at runtime
When the engine reaches a script task:
-
The engine executes the script with the process variables available in the current scope.
-
If the script completes successfully, the engine advances to the next step.
-
If the script fails — for example, due to a runtime error or an undefined variable — the engine records an incident on the script task.