Skip to content

Does pattern support Bulk DML retries when allOrNothing=false? #1

@cropredy

Description

@cropredy

I think this is true after inspecting your trigger pattern. Looking for verification and suggesting you add to your documentation.

If doing a bulk DML operation such as Database.insert(sobjList,false), per the Apex documentation, if some records fail, Apex will attempt a second and possibly third retry on the failing sobjects.

You would not want the trigger recursion static variables to be remembered for the second or third retry as otherwise the retry logic will not execute one's trigger handler business logic.

I believe your pattern addresses this because on a retry, per the doc, the trigger refires which means the xxxObjectTriggerHandler will be reinstantiated for the retry set and thus reset the isXXXXFirstRun booleans.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions