Explicitly set RunTrigger
The Insert, Modify, ModifyAll, Delete, and DeleteAll methods on the Record type all accept an optional RunTrigger parameter that defaults to false. When the parameter is omitted, the call is ambiguous: Customer.Modify() could mean the developer deliberately chose not to fire triggers, or it could mean they forgot the parameter entirely.
A reviewer who encounters the bare call has no way to distinguish intent from oversight. If they guess wrong and add true, they introduce trigger execution in a code path that was designed to bypass it — potentially firing validation logic, posting routines, or event subscribers that corrupt the record state.
Pass the RunTrigger parameter explicitly on every call, even when the intended value is false.
The diagnostic is reported on the following methods when the RunTrigger parameter is omitted:
| Method | Signature |
|---|---|
| Insert | Record.Insert([Boolean], [Boolean]) |
| Modify | Record.Modify([Boolean]) |
| ModifyAll | Record.ModifyAll(Any, Any [, Boolean]) |
| Delete | Record.Delete([Boolean]) |
| DeleteAll | Record.DeleteAll([Boolean]) |
Example
procedure CreateCustomer()
var
Customer: Record Customer;
begin
Customer.Init();
Customer."No." := '10000';
Customer.Insert(); // Explicitly set RunTrigger [LC0040]
end;Pass true when triggers and event subscribers should execute — typically when the operation mirrors what a user does through the UI. Pass false when triggers must not fire, such as during data migrations or internal bookkeeping.
procedure CreateCustomer()
var
Customer: Record Customer;
begin
Customer.Init();
Customer.Validate("No.", '10000');
Customer.Insert(true);
end;See also
- Insert, Modify, ModifyAll, Delete, DeleteAll, and Truncate methods on Microsoft Learn
- Code with Clear Intention by Teddy Herryanto