Explicitly set RunTrigger

Properties
LC0040 Info Design Code Fix Ignore Obsolete

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:

MethodSignature
InsertRecord.Insert([Boolean], [Boolean])
ModifyRecord.Modify([Boolean])
ModifyAllRecord.ModifyAll(Any, Any [, Boolean])
DeleteRecord.Delete([Boolean])
DeleteAllRecord.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