Skip to content

EventHandlerExample

Easit AB edited this page Dec 18, 2020 · 1 revision

Configuration example - Event handler

Item event handler

In order to export an item to EasitPSHttpServer you will need an event handler that uses the action Export item. The following screenshots and details gives you a example for an event handler that exports an item from Easit GO to EasitPSHttpServer when the item is created.

Listen to

In this example we will listen to the event ON_AFTER_ITEM_SAVE. This event takes place after every change to the item have been saved in the database and therefore ensures us that the items data will not be changed after the export is done. For example, if you have a event handler running on ON_ITEM_SAVE the item may be updated by another event handler running after "yours".

ENG SWE
eventHandler-listenTo-eng eventHandler-listenTo-swe

Modified fields

The event handler will on run if the field Created is changed. If this field is not changed for the item the event handler will not run.

ENG SWE
eventHandler-modifiedFields-eng eventHandler-modifiedFields-swe

Field rules

The field Created have to changed in the way we define it. In the example above we specify that the field need to be NOT EMPTY after the item have been saved to the database. We do not care what the fields value was before the change.

ENG SWE
eventHandler-fieldrules-eng eventHandler-fieldrules-swe

Actions

In this event handler we are using the action Export item when the event handler runs. We have configured the action to export the item to EasitPSHttpServer running on localhost listening on port 9080. In our setup of EasitPSHttpServer, the default setup, we use the value specified as Identifier to know what script to run from EasitPSHttpServer. This event handler will trigger a script called addADUser.ps1.

ENG SWE
eventHandler-actions-eng eventHandler-actions-swe
eventHandler-actions-details-eng eventHandler-actions-details-swe