Triggers
    • 07 Jun 2022
    • PDF

    Triggers

    • PDF

    Article summary

    For each SysAid entity, you can create form events called triggers. This tab allows you to create the different triggers for the entity you've chosen.

    Note

    For Cloud accounts, this section of advanced field customization is available only via our Professional Services team. If you need to access this feature please contact care@sysaid.com

    CustomizeEntityTriggersfilesUpdatedEntityTriggers.png

    There are four different trigger types: on load of the form, before saving the form, or after saving the form.Triggers allowyou to automatically perform your own custom operations when using the different forms within SysAid.

    On Load
    These triggers will run the moment you load the form, and should be written in Java. As an example, a trigger for the service record entity could check to see if the SR due date has passed and create a popup notifying the administrator if this is the case.

    Before Save
    These triggers will run after you hit OK/Apply, but before the data is passed from the form and processed by the serverto the database. Use JavaScript for these triggers. Before Save triggers are useful for data validation, but can also be used to modify data that's been entered in the form before it's saved to the database. An example trigger of this type could look at integer fields and remove any commas that a user has entered into the number so that it will be saved correctly in the database (i.e. 2,000 would become 2000).

    Before Entity Save
    These triggers will run after you hit OK/Apply, but before the data is saved to the database. Before Entity Save triggers can also be used to modify data that's processed by the server right before it's saved to the database. An example trigger of this type could look at integer fields and remove any commas that a user has entered into the number so that it will be saved correctly in the database (i.e. 2,000 would become 2000). This allows for processing data manipulation and other server logic that could be applied before the data is saved in the database.

    After Save
    These triggers should be written in Java, and will perform an action after the data has already been saved in the database. An example for the service record entity would be creating a new task if the saved service record status = closed and the reopen counter = 0.

    More information
    Please consult our SysAid API Guide for more information about writing custom triggers.