Script Task
A Script Task executes an automated script written in a language the process engine can interpret. Unlike Service Tasks that call external services, Script Tasks run inline code within the engine.
What is a Script Task?
A Script Task executes code scripts directly within the process engine. The script is typically written in JavaScript, Groovy, Python, or another language supported by the engine, running inline without external service calls.
Visual Representation
A Script Task shows a rounded rectangle containing a document/script icon (often depicted as a page with lines). This represents the inline code or script to be executed.
Key Characteristics
- Inline execution: Script runs within the process engine, not externally
- Engine-dependent: Available languages depend on the process engine
- Variable access: Can read and write process variables directly
- Quick logic: Ideal for simple calculations, transformations, or data manipulation
Common mistake
Putting complex business logic in a Script Task. Script Tasks should be lightweight (data transforms, calculations). For complex logic, use a Service Task calling a proper service.
How it connects
Common Use Cases
Data Calculation
Calculate order totals, tax amounts, and discounts using a simple inline script.
Variable Transformation
Transform data formats or concatenate fields before passing to the next activity.
Conditional Logic
Evaluate complex conditions and set flag variables for downstream gateway decisions.
Frequently Asked Questions
Related BPMN Elements
Model this in Crismo
Create BPMN diagrams with AI assistance. Free, no signup needed.