Events are key points within a Business Central process that can be used to trigger alerts. They're linked to an Alerts Table.
Custom Events are used in place where standard triggers (i.e. Table Changes) aren't detailed enough for a specific business scenario. They're a specific string, i.e. GLPOST which is used by Alerts and the Code.
You can see a list of included events here.
You can create custom events by integrating with Alerts via your own AL extension/app (see Development in AL).
Integrating with Alerts via an extension
- Add a dependency to the Alerts app in your AL project. Make sure to use up-to-date values from extension management in Business Central.
- Call the ScheduleEventAlert function from codeunit FSG_ALT_AlertEventListener where you want the alert to trigger. You will need to provide the following parameters:
Parameter Explanation RecRef The RecordRef of the record the event is being called upon. xRecRef The RecordRef of the record before any changes have been made. EventCode Specifies a unique code to identify this type of event. IsDelete Specifies if the record has/will be deleted within the current code execution.
Creating and using a custom event
- Locate and open the Alert Tables page.
- Create or highlight an alert table appropriate for the event and then select Events.
- Create a new alert event.
Field Explanation Code Specifies a unique code to identify this type of event. Description Specifies a description for the event.
- Create a new Alert (see Creating a new alert using the Wizard), specify the trigger as event, and the table and event code from step 1 & 2.