Understanding database triggers
Data in the database is constantly changed - records are inserted, updated, deleted. Almost any user action results in data modification, and all modifications of data run application triggers.
How to do it...
In this recipe we will learn how to use some of the most important and frequently used table triggers to control data flow.
- Open table 50010 Item Certificate in object designer. Click C/AL Code in the View menu or press F9 to open table code. Open C/AL Globals and create two functions,Â
DeleteCertificateActions
andUpdateItemOnActions
. - Position cursor in the
DeleteCertificateActions
 variable and declare a local record variableItemCertificateAction
:Name
DataType
Subtype
ItemCertificateAction
Record
Item Certificate Action
- This is a simple function with lines of code in it:
ItemCertificateAction.SETRANGE("Certificate No.","No."); ItemCertificateAction.DELETEALL;
- Move to the function
UpdateItemOnActions...