Skip to content

Event Module

The Event Module triggers events to notify listener tasks of specific occurrences. Events are triggered at the domain level and can execute listeners in other processes.

Warning

Events are processed synchronously. Any exceptions encountered will result in a transaction rollback.

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

Event Name:
The name of the event(s) to trigger. 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 semicolons (e.g., "Customer.New;Customer.Update.{{Id}}").

Event Data XPath:
The XPath expression defining the event data to be passed to listeners. If left empty, the root element content is used. The $Input XML node variable provides access to relevant event data.

Handle Script:
A script to process event results and determine subsequent workflow actions. If no script is defined, the first available action is automatically selected. Event results are stored in the $Handlers array, containing the IDs of the work items that handled the event. If no listeners exist, the array will be empty.

Scripting Objects

This script is executed in the backend context of the Emakin and does not have an accessible a browser DOM context and therefore navigator based JavaScript libraries such as jQuery are not available.

The following objects are available:

  • $Handlers Array instances of event handling WorkItem instances. When there is no handler for an event, the array will be empty.
  • $WorkItem Current WorkItem that is being processed.
  • $Instance Instance of the Instance current workflow instance.
  • $TestMode Indicates whether the workflow is running in test mode. In test mode, evaluates to true value.
  • $Priority Priority of the current workflow instance 0 (lowest) to 5 (highest
  • $Initiator Identifies the workflow initiator. Note that this may be null for module-type tasks.
  • $Culture Current culture of the workflow instance. Originated from the initiator's culture but can be overridden. Culture is specified in the format languagecode2-country/regioncode2. Example: (en-US or tr-TR)
  • $Templates Provides access to templates defined in the pool definition. Used for rendering the text content depending on the culture of the workflow instance.
  • $Xml Provides access to the process data model or workflow data.
  • $Case Instance of Case instance if workflow started on a case.
  • $poolVariable Custom defined pool variable by name. Variables are defined in Variables
  • $Services Allows calling SOAP services with JSON or XML content types.
  • $Decisions Allowing you to execute decision tables and models on process.
  • $scriptModule Custom defined script module. Script modules are defined in Script Modules
  • $Domain Provides access to the domain information and related methods like initiating a workflow or creating a new case.
  • $ActivityStream Allows pushing system-generated activities to the domain activity stream.
  • $Membership Provides access to users and organizational database objects.
  • $Database Allows you to perform relational database operations.
  • $Crypto Provides access to cryptographic functions such as hashing and encryption.
  • $Rest Allows interaction with REST services using JSON or XML content types.
  • $Calendar Provides access to calendar functions like adding or subtracting date in calendar rules.
  • $Files Allows access to the standard file repository for basic files.
  • $Documents Provides access to the document archive.
  • $Delegation Pprovides methods to manage delegations between users.
  • $Messages Provides functionality for sending new e-mails and parsing existing e-mail messages.
  • $XmlRepository Provides access to the non-relational XML repository database.

Remarks

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

If the module script does not explicitly select an action, an exception will be thrown and execution is stopped.