Triggers
Triggers are used to automatically execute specified actions when certain criteria are met in the system.
Trigger Features
Triggers are extremely useful for executing workflow, notifications, integration, or other tasks in the system to automatically take place whenever certain changes occur in the system.
Trigger Core Functionality
Triggers have 3 core functions dictating how they work:
- Trigger Type: The type of object a trigger is monitoring
- Gates: The conditions that must be met for the Trigger to occur
- Action: The type of Action a trigger executes
Trigger Type
The type of object a Trigger can work against is any type of entity in the system, including Custom Entities and any created through our API.
Gates
The conditions a Trigger needs to meet before the action is executed.
Tip
You can create as many gates as you like for a Trigger. Only one gate needs to be valid in order for the Action to be executed.
Each Gate can evaluate the Object Type for the Trigger itself, or any other Object Type in the system via a relationship to the Object Type of the Trigger. Those object types can be monitored for the following changes:
- Insert
- Update
- Delete
Just that change can be enough for a Trigger, or optionally you can create formulas that must be valid on the Object Type too.
Action
When a Trigger is activated and passes a Gate, the associated Action is executed.
All Trigger Actions inherit the base LemonEdge.API.Tasks.Process.Triggers.BaseTriggerTask - see our [API](........\API) for more information. Using our API you can create any custom Action you like that can be automatically executed through a Trigger, and thus deeply integrated into the LemonEdge platform.
The default Trigger Tasks are as follows:
- Trigger Notification Task
This Action notifies any Watchers, against the Triggered Item, with a custom message of your design. The notification can be via the system, email, both or custom. - Trigger Custom Task
This Action runs any other Server Task in the system with your specified parameters
Note
Each Trigger Task has its own set of custom parameters that are available to configure.
Process
Triggers don't slow down saving, or any other pat of the system because they don't run instantly as part of the save process.
Instead when changes are being made in the system (through a save or other mechanisms) the system identifies if there are any possible trigger gates that may be affected by that save. If so it goes through the following steps:
- Creates a Trigger Task to be run on the Task Server that holds the datatime stamp of the save and the possible types of items in the save that could match a trigger.
- This task runs after the save transaction is completed and picked up by a Task Service
- The service processes the task and gets all changed items in that save from the system that match possible gates
- The system evaluates all the gates with the changed data
- For any gates that pass the associated Trigger Action is then executed
- This only occurs once for each Trigger regardless of however many gates pass.
Triggers are extremely powerful and versatile allowing you to configure simple emails to users whenever data they are interested in is modified, all the way up to creating your own custom Actions that can execute whenever associated changes are detected in the system.
Views
Triggers have the following views: