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.

event-handling-1

  • Name*. Enter a name for the handler.
  • Event domain. Select an area where the handler will listen for events:
    • All events.
    • App items. You can select an app whose events will be handled. If an app is not selected, the module will track the events of all the apps in the system. Note that if an app is selected, the module cannot be exported due to export restrictions for modules associated with an app that is not part of the module;
    • 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 which will occur after each event.
    • Run script. Executes a script.
    • Run process. Executes a business process created in the module.
    • Send message to service. Sends a message to an external microservice. This activity is available only in ELMA365 On‑Premises.

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

Only processes and scripts created as part of the module can be bound to a handler.

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

  1. Click the Save button.
  1. In the window that opens select the required process, script, or microservice.

event-handling-2

  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:

  • Additional parameters are changed

For the Users domain:

  • Authorization failed
  • Authorization success
  • Authentication failed
  • Authentication success
  • Signing out

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.

event-handling-3

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