Bewerken

Delen via


OnModify (Table) trigger

Version: Available or changed with runtime version 1.0.

Runs when a user modifies an existing record in a table.

Syntax

trigger OnModify()
begin
    ...
end;

Remarks

This trigger is run before the default modify behavior, which checks that all the fields of a record are valid before the modification occurs. It runs automatically when the user changes at least one field (different from the primary key field) of a record in a page from the Web Client. If a user modifies a record using AL code, then the RunTrigger argument of MODIFY (Record) Method or MODIFYALL (Record) Method must be set to true for the OnModify Trigger to run, or otherwise it will not. If an error occurs in the trigger code, the record changes are canceled.

We recommend that you do not include code that can stop the user from recording a change in the OnModify trigger on a table. For example, do not include code for displaying error messages. If a user has previously changed the contents of some fields in a record, then these changes must always be accepted by the system.

Get Started with AL
Developing Extensions
OnModify (Table Extension) Trigger