Service Task Activity
The Service Task activity enables the execution of automated logic through web services or external applications. It facilitates the integration of custom Java classes and expressions to automate process steps without human intervention.
| Field | Description | Requirement |
|---|---|---|
| Exclusive | Ensures that jobs from a specific process instance are executed sequentially when receiving specialized tasks. | Optional |
| Set service task to be triggerable | Configures the task to wait for an external trigger to signal process continuation after the initial execution. | Optional |
| Execution listeners | Defines listeners that trigger logic during activity, process, sequence flow, or event lifecycle transitions. | Optional |
| Multi-instance type | Determines if the activity creates multiple instances, either in parallel or sequentially. | Optional |
| Cardinality (Multi-instance) | An integer or expression that defines the specific number of instances to be created. | Optional |
| Collection (Multi-instance) | A collection variable where each element triggers the creation of a unique activity instance. | Optional |
| Element Variable (Multi-instance) | The variable name used to access the current collection element within a specific instance. | Optional |
| Completion Condition (Multi-instance) | A boolean expression that, when evaluated as true, prevents the creation of further instances. | Optional |
| Is for compensation | A flag indicating whether the activity is dedicated to compensation logic within the process. | Optional |
| Class | The fully qualified name of the Java class that implements the service task logic. | Optional |
| Expression | A JUEL expression that is resolved and executed when the task is reached. | Optional |
| Delegate expression | A delegate expression used to resolve the service task logic at runtime. | Optional |
| Class fields | Allows the injection of specific field values into the delegated Java class. | Optional |
| Result variable name | The name of the variable where the output of the service task execution is stored. | Optional |
| Use local scope for result variables | Specifies whether the result variable should be stored within the local scope of the activity. | Optional |
| Skip expression | An expression evaluated prior to execution to determine if the task should be bypassed. | Optional |
Action Types & Examples
Multi-instance type
- Format: String (None, Parallel, Sequential)
- Example Result: "Sequential"
Cardinality (Multi-instance)
- Format: Integer or JUEL expression
- Example Result: "2"
Completion Condition (Multi-instance)
- Format: Boolean expression
- Example Result: "${variable == true}"
Expression
- Format: JUEL expression
- Example Result: "${clientService.createNewClient(firstName, lastName, email)}"
Result variable name
- Format: String
- Example Result: "resultvar"
Implementation Examples
Field Setup - Multi-instance type: Parallel - Element Variable (Multi-instance): elementvar - Result variable name: resultvar - Execution listeners: End
Execution Parameters - Cardinality (Multi-instance): ${number} - Expression: ${firstName} - Skip expression: ${firstName} - Completion Condition (Multi-instance): true
Technical Notes
Service tasks are used to invoke external services or automated logic. When the process engine reaches a Service Task, it executes the logic defined in the class, expression, or delegate expression. If the task is configured as triggerable, the process execution will wait for an external signal to proceed after the task logic has been executed. For multi-instance configurations, sequential execution is generally recommended for service tasks to maintain data integrity.