A Script Task executes an automated script implemented locally within a process. Script tasks allow scripts to be included directly in a process definition.
Use this task when process logic must be performed through a script, such as manipulating variables, transforming data, or executing custom business logic. This usage guidance is a recommendation based on the purpose of script tasks; the source only states that they execute automated scripts.
During execution the associated script is executed locally within the process. The task behaves as a service task with an implementation value of script.EXECUTE. The associated script name is stored as the value of _activiti_script_ in the Extensions Editor. After script execution completes, the process continues to the next activity.
Script Tasks are displayed as a thin rounded rectangle containing a script icon:
For more information on adding scripts, see Scripts.
The basic properties of a script task are:
| Property | Required | Description |
|---|---|---|
| ID | Required | Unique identifier for the user task. The value is generated automatically and cannot be modified. Example: UserTask_0w526j8. |
| Name | Optional | Name displayed on the process canvas. |
| Description | Optional | Description of the user task. Expressions can be used to generate dynamic descriptions based
on process variables. The rendered value is displayed in Digital Workspace and Admin
applications. The description can be made dynamic by writing an expression, for example: ${workflowType} for ${dealNumber} Closing Coordinator Task - Review Document. In the Digital Workspace and the Admin app, the expression is dynamically rendered as a user-friendly task description. For example, the previous expression might render as: Commitment and Policy for DEA1235385 Closing Coordinator Task - Review Document. |
| Asynchronous Continuation | Optional | When enabled, the task executes in the background using a separate transaction from the overall process execution. |
| Multi Instance Type | Required | Defines whether the task executes once or multiple times for a collection of items. The selected option determines the multi-instance execution behavior. For more information, see Understanding Multi-Instance Activities. |
| Mapping Type | Required | Defines how data is passed between the task and the process. The selected mapping type determines which process variables are available to the task and how output values are returned to the process. For more information, see Mapping Process Variables. |