Script task

Script task activity executes processes that modeler or implementer defines a script in a language that the engine can interpret.

Script format Script format of the script task that will be selected from combobox.
Script Script text of the script task.
Exclusive When it receives a special job from a specific process example, it makes jobs run in order.
Execution listeners Listeners for an activity, process, sequence flow, start and end event.
Multi-instance type Determines if multiple instances of this activity are created.
Cardinality (Multi-instance) An expression or numeric value (integer) that determines how many instances are created.
Collection (Multi-instance) The number of instances is determined by the elements of a collection. For each element in the collection, a new instance is created.
Element Variable (Multi-instance ) The variable under which each element is available to the newly created instance.
Completion Condition (Multi-instance) An expression that, if it evaluated to true , stops the creation of new instances.
Is for compensation A flag that identifies whether this activity is intended for the purposes of compensation.
Auto store variables Automatically stores any variable defined in the script on the execution. Please note that some languages such as JavaScript do not support this feature.

Script format examples

You can use the Script format as shown in the examples.

Groovy

JavaScript

Script examples

You can use the Script as shown in the example.

var today = new Date(); 
var a = new Date(today.getFullYear(), today.getMonth()+1, 0); 
var b = a.toString();  
execution.setVariable("tarih",b);

Execution listeners examples

You can use the Execution listeners as shown in the examples .

Start

End

Take

Multi-instance type examples

You can use the Multi-instance type as shown in the examples.

Default, only one instance is created:

None

Activities are created in parallel. This is a good practice for User tasks activity:

Parallel

Activities are created sequentially. This is a good practice for Service tasks activity:

Sequential

Cardinality (Multi-instance) examples

You can use the Cardinality (Multi-instance) as shown in the examples.

${number}

2

Collection (Multi-instance) example

You can use the Collection (Multi-instance) as shown in the example.

2

Element variable (Multi-instance) example

You can use the Element variable (Multi-instance) as shown in the example.

elementvar

Completion Condition (Multi-instance) example

You can use the Completion Condition (Multi-instance) as shown in the example.

true

${variable==True}

Note – Custom Scripts

  1. To create a script;
  2. Fill in the Script name, Script description, and the script content to be added using the “Script – Add New Custom Script” button.
  3. Click on the “Save” button to save the script.
  4. Access the added script from “Scripting Helper – JS Custom Scripts”.
  5. To edit a script;
  6. Select the created script from “Scripting Helper – JS Custom Scripts” and click on the “Edit” button.
  7. To delete a script;
  8. Select the created script from “Scripting Helper – JS Custom Scripts” and click on the “Remove” button.