Skip to content

IF_Trigger.BeforeInsert

Class

apex
global interface IF_Trigger.BeforeInsert

Known Derived Types: TRG_ExecuteValidationRules, TRG_ExecuteValidationRules.beforeInsert(List<SObject>)

Handler contract for the before-insert trigger event.

Since: 1.0


Methods

MethodDescription
global abstract void beforeInsert(List<SObject> newRecords)Called before records are committed to the database, allowing field defaulting, validation, or in-memory enrichment of the incoming batch.

Method Details

beforeInsert

apex
global abstract void beforeInsert(List<SObject> newRecords)

Called before records are committed to the database, allowing field defaulting, validation, or in-memory enrichment of the incoming batch.

Parameters:

  • newRecords (List) - The batch of SObjects about to be inserted.

Since: 1.0

Example:

apex
public class TRG_SetAccountDefaults extends TRG_Base implements IF_Trigger.BeforeInsert
{
    public void beforeInsert(List<SObject> newRecords)
    {
        for(SObject record : newRecords)
        {
            record.put('Status__c', 'Draft');
        }
    }
}