Event triggers

Introduction to event triggers

Event triggers are interrupts which signal that a certain event has occurred for a case. They are attached to scopes. A scope can have several event triggers. Event triggers can react to all kind of changes, for example changes to case data, the assignee or the relations of the case. The actions which should be performed when the event occurs need to be scripted in an automatic activity connected to the trigger.

Examples for the use of event triggers:

Process logic with event triggers

The following general logic applies to event triggers:

  1. The event defined in the event trigger occurs for a case in the scope where the trigger is attached.

  2. The trigger fires, i.e., it signals that the event has occurred.

  3. The script defined within the trigger is executed. If it returns true, the following automatic activity or decision node with two following automatic activities is executed.

If a change affects more than one case parameter and different event triggers have been defined for these parameters at the scope, the event triggers fire according to their order at the scope, from the left to the right. If an automatic activity causes the case to leave the scope where the triggers are attached, e.g., by moving it to another queue with a jump-out node, the other triggers do not fire.

If there are event triggers which react to the same change in nested scopes, the event is handled by the trigger in the innermost scope. If the trigger in the innermost scope does not react to all the events which occurred, the events which have not been handled yet, are passed to the next outer scope.

Best practice:

  • Attach the event trigger to the innermost possible scope to avoid unnecessary trigger executions.

  • If there is an activity which modifies certain case data and a trigger reacting on these changes should not be executed, move the activity outside the scope where the trigger is located.

  • The automatic activity which follows an event trigger should not make any modification to the case parameters which the trigger reacts to. This would cause a loop as the trigger would fire again after its activity has been executed. If modifications to the case parameters which a trigger reacts on are required, move the activity outside the scope where the trigger is located.

Available settings for event triggers

The following settings are available for event triggers:

Programming with event triggers

You can obtain an object of the type TicketChanges which contains the modifications done to the case:

workflowApi.getTicketUpdateEvent().getModifications()