Skip to content

Event Listener Module

The Event Listener Module waits for specific events and initiates new workflow instances or performs actions upon event occurrence. Events are triggered at the domain level and may originate from other processes.

In addition to the common task properties, the following properties are configurable:

Event Name:
The name of the event(s) to listen for. This can be a plain text string (e.g., Customer.New) or utilize data template expressions to incorporate data model values (e.g., "PaymentComplete.{{Id}}"). Multiple event names can be specified using semicolon delimiters (e.g., "Customer.New;Customer.Update.{{Id}}").

Handle Script:
The script executed when an event is received. This script determines the workflow's subsequent actions. If left unset, the workflow engine automatically selects the first available action. The attached event data is accessible via the $Input variable as an XML instance.

If the task is configured as a starting point, a new workflow instance is initiated, and event data is mapped to matching nodes in the current workflow's data model. If the handle script does not specify an action, the workflow instance reverts. If the task is not a starting point, the workflow instance pauses until the event occurs. In this case, if the handle script doesn't define an action, the instance remains paused awaiting the next event.

System Events

Emakin automatically fires the following events for integration purposes.

User Events

User.Register

Fired when a new user registers with the system. Registration occurs upon a first-time login under the current usage terms. If tenant usage terms change, re-registration with the updated terms is automatically triggered.

This event does not include input data. It expects a new workflow instance to be created and assigned to the user. If no workflow instance is created, registration completes automatically. This event is designed to comply with GDPR consent requirements.

Case Events

The following events are triggered upon completion of operations on a case instance. The $Case scripting variable automatically holds the case instance data for the triggered event.

The following Case events are available:

  • Case.Open: Fired when a case's status changes to "Open".
  • Case.Assign: Fired when a case is assigned to a user or assignment is cleared.
  • Case.Update: Fired when case properties (Subject, Description, Deadline, Profile, etc.) are updated.
  • Case.Close: Fired when a case's status changes to "Closed".
  • Case.Delete: Fired when a case is deleted from the system.
  • Case.Deadline: Fired when a case deadline is reached.
  • Case.Reply: Fired when a case receives a reply (e.g., via email or another system).

Warning

Case events are processed synchronously. Any exceptions will result in a silent rollback of the transaction.

Input Data for Case Events

Case events provide the following example XML data, accessible via the $Input variable:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<Case xmlns="http://schemas.emakin.com/case">
    <Id>43b21104-5805-40c2-b174-59c3c612977f</Id>
    <ChannelId>a272d0cf-04aa-4dd9-ba84-4c6fbe3818b8</ChannelId>
    <Number>24133</Number>
    <Subject>My Case</Subject>
    <Description>My Description</Description>
    <IsClosed>False</IsClosed>
    <DeadlineAt>2025-02-03T00:13:00</DeadlineAt>
    <Priority>Normal</Priority>
    <ContentType>Job Order</ContentType>
    <ContentTypeId>89e9d051-e04f-46fa-81dd-47c736138831</ContentTypeId>
    <CreatedAt>2022-07-22T14:05:43.7285220+03:00</CreatedAt>
    <CreatedBy Caption="John Doe" Domain="41aedbcf-01a4-4517-8a2e-4c669d432652" Type="User">467a3ace-3e67-4c44-ae75-7a48bad80490</CreatedBy>
    <UpdatedAt>2022-07-22T14:05:43.7367360+03:00</UpdatedAt>
    <UpdatedBy Caption="John Doe" Domain="41aedbcf-01a4-4517-8a2e-4c669d432652" Type="User">467a3ace-3e67-4c44-ae75-7a48bad80490</UpdatedBy>
    <AssignedTo Caption="John Doe" Domain="41aedbcf-01a4-4517-8a2e-4c669d432652" Type="User">467a3ace-3e67-4c44-ae75-7a48bad80490</AssignedTo>
    <AssignedAt>2022-07-22T14:05:43.7367360+03:00</AssignedAt>
    <ClosedAt>2022-07-22T14:05:43.7367360+03:00</ClosedAt>
    <UserTags>
        <Tag>
            <Id>a0cb3ce3-788d-4567-9e62-f24dcb5c20bd</Id>
            <Name>User Tag</Name>
        </Tag>
    </UserTags>
    <SystemTags>
        <Tag>
            <Id>80bc3bc6-8a8a-43ce-b2b4-f140c89c888c</Id>
            <Name>System Tag</Name>
        </Tag>
    </SystemTags>
    <Profile>
        <JobOrder xmlns="" State="Current">
            ...
        </JobOrder>
    </Profile>
</Case>

Remarks

If the module's script is left empty, the first available action will be automatically selected.