I am having a scenario and want to know after running into an Apex CPU limit error
whether anything is committed to the database
For Example : I'm in a batch that updates an object that then activates a trigger,
would it stop at the object level or at the trigger level or does it depend on
when the apex limit is hit?


Any governor limit, including Apex CPU timeouts, reverts all changes to the database for the entire transaction. That means no records are created, updated, deleted, undeleted, merged, converted, etc. The only exception to this rule is that any logs that are enabled will be preserved (in Setup > Monitoring > Debug Logs). In the case of a batch, if it occurs in the start method, the entire batch is aborted, while if it occurs during an execute function, only that single batch is aborted (but prior batches are already committed, and future batches may still successfully commit), and in the finish method, a governor limit would prevent chaining calls, sending emails, etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.