Modules > Custom modules / Event handling in modules

Event handling in modules

You can configure the handling of various system events in a custom module.

An event handler triggers a specific action in the system after an event occurs. It can be useful when creating complex modules. For example, an event handler can start a business process configured within a module when an app item is edited.

A handler can be used to run a script, start a business process, or send a message about the event to an external microservice.

начало внимание

The Send message to service activity is available only in ELMA365 On-Premises.

конец внимание

To add an event handler:

  1. Go to Administration > Modules.
  2. Hover the mouse over a module and click the gear icon.
  3. Go to the Event Handling tab.
  4. Click +Handler and enter the information in the window that opens.


  • Name*. Enter the name of the handler.
  • Event domain. Select an area where the handler will listen for events:
    • All events.
    • App items. Select the app whose events are to be processed in Object type filter that appears. If you do not select an app, the module will track the events of all existing apps in the system. Please note that, if an app is selected, it is impossible to export the module. This is due to the restriction on exporting a module associated with an app that is not part of the module.
    • Tasks. The handler will record events related to the creation, modification, cancelation, or termination of CRM tasks. In the Task type filter field that appears, specify the type of activity whose changes will be tracked by the module: All CRM Tasks, Call, Email, Webinar, or Meeting.
    • Apps.
    • Files.
    • Directories.
    • Modules.
    • Settings.
    • Users.

начало внимание

The Files domain is available only in ELMA365 On-Premises.

конец внимание

  • Event. Select an event that will trigger the handler. The list of events is different for different domains. We have listed available events for each domain below.
  • Handler type. Select an activity that will occur after each event.
    • Run script. Executes a script created in the handler.
    • Run process. Executes a business process created in the module in the Processes tab.
    • Send message to service. Sends a message to an external microservice. This activity is available only in ELMA365 On‑Premises.
  1. Click the Save button.
  1. In the window that opens:
  • for the Run script type. Write a script on the Scripts tab. You can access variables from other workspaces and custom modules by configuring optional dependencies.

начало внимание

To make the adding optional dependencies available, the system administrator needs to enable the allowScriptImportsDependencies flag.

конец внимание

To create a dependency on the top panel, click Settings and add workspaces and modules to the list. They can then be accessed via the Imports global constant. A module with optional dependencies can be exported without restrictions.


  • For the Run proccess type. Select the business process created at the module level. Then, on the Input variables tab, map variables from the process context to the event properties: object, name, author, and so on.


  • For Send message to service type. Specify the microservice
  1. To finish the configuration, click Save and Publish.

This way you can add several event handlers to a custom module. For example, when an app item's status changes, a business process for contract approval starts. By using a script or a gateway you can activate different process branches depending on the status that the app item acquires.

Available events

Each event domain has its list of events that can trigger a handler.

For the All events domain, the only option is All system events.

For the App item domain, you can choose one of the following events:

  • Comment is added to an app item
  • App item status is changed
  • App item is created
  • App item is deleted
  • App item is updated

For the Apps domain:

  • App data export
  • App data import

For the Files domain:

  • Comment is added to a file.
  • File is created
  • File is deleted
  • Access permissions for the file are changed.
  • File is modified

For the Directories domain:

  • Directory is created
  • Directory is deleted
  • Access permissions for a directory are changed
  • Directory is modified

For the Modules domain:

  • Module is disabled
  • Module is enabled
  • Module is installed
  • Module is updated

For the Settings domain, the only option is Additional parameters are changed.

For the Users domain:

  • Authorization failed
  • Authorization success
  • User creation
  • User deletion
  • User update
  • Excessive failed login attempts
  • Authentication failed
  • Authentication success
  • Signing out
  • User status changed
  • Access to the data is denied.

Cancel a handler

To disable a handler, go to the Event Handling tab and click on the three dots icon opposite the handler’s name. Select Cancel publication. Now the handler will not be triggered when the event occurs.

You can also delete an event handler. To do this, go to the Event Handling tab, check the box next to one or more handlers, and click the Delete button in the upper right corner of the page.


Found a typo? Highlight the text, press ctrl + enter and notify us