Skip to content

Script Task Activity

The Script Task activity enables the execution of custom scripts defined by the modeler or implementer in a language compatible with the engine. This activity allows for complex logic, data manipulation, and variable management to be processed directly within the workflow.

Field Description Requirement
Script format Specifies the programming language or format of the script to be executed. Required
Script Contains the actual script logic to be processed by the engine. Required
Exclusive Ensures that jobs are executed sequentially when receiving tasks from specific process instances. Optional
Execution listeners Configures listeners for activity, process, sequence flow, start, and end events. Optional
Multi-instance type Defines whether the activity creates single or multiple instances (None, Parallel, or Sequential). Optional
Cardinality (Multi-instance) An expression or integer that defines the specific number of instances to create. Optional
Collection (Multi-instance) A collection of elements where each element triggers the creation of a new instance. Optional
Element Variable (Multi-instance) The variable name assigned to the current element within a multi-instance execution. Optional
Completion Condition (Multi-instance) A boolean expression that terminates instance creation upon evaluating to true. Optional
Is for compensation A flag indicating if the activity is designated for compensation logic. Optional
Auto store variables Automatically saves script-defined variables to the execution context. Optional

Action Types & Examples

Script Format

  • Format: string
  • Example Result: "JavaScript"

Multi-instance Type

  • Format: string
  • Example Result: "Parallel"

Completion Condition

  • Format: boolean or expression
  • Example Result: "${variable==True}"

Implementation Examples

Field Setup - Script format: Groovy - Script: var today = new Date(); var a = new Date(today.getFullYear(), today.getMonth()+1, 0); var b = a.toString(); execution.setVariable("tarih",b); - Execution listeners: Start - Multi-instance type: Sequential

Execution Parameters - Cardinality (Multi-instance): ${number} - Collection (Multi-instance): 2 - Element Variable (Multi-instance): elementvar - Completion Condition (Multi-instance): true

Technical Notes

To manage custom scripts, use the Scripting Helper. New scripts are created by defining a name, description, and content via the "Script – Add New Custom Script" button. Existing scripts can be modified or removed by selecting the target script within the "JS Custom Scripts" section and selecting the "Edit" or "Remove" actions respectively. Note that the "Auto store variables" feature is language-dependent and is not supported by all languages, such as JavaScript.