You’ve probably written many Apex triggers in Salesforce development. Most of them work as expected as long as they are attached to the correct object. However, there are certain object operations that do not invoke the corresponding triggers, even though you might assume they do.
Here are some object operations where Apex triggers do not fire:
- Cascading delete operations. Records that did not initiate a delete don’t cause trigger evaluation.
- Cascading updates of child records that are reparented as a result of a merge operation
- Mass campaign status changes
- Mass division transfers
- Mass address updates
- Mass approval request transfers
- Mass email actions
- Modifying custom field data types
- Renaming or replacing picklists
- Managing price books
- Changing a user’s default division with the transfer division option checked
- Changes to the following objects:
- BrandTemplate
- MassEmailTemplate
- Folder
- Update account triggers don’t fire before or after a business account record type is changed to person account (or a person account record type is changed to business account.)
- Update triggers don’t fire on FeedItem when the LikeCount counter increases.
Notes on some special cases:
Person Account
Inserts, updates, and deletes on person accounts fire Account triggers, not Contact triggers.
Opportunity
Opportunity triggers are not fired when the account owner changes as a result of the associated opportunity’s owner changing.
The before and after triggers and the validation rules don’t fire for an opportunity when:
- You modify an opportunity product on an opportunity.
- An opportunity product schedule changes an opportunity product, even if the opportunity product changes the opportunity.
- Roll-up summary fields do get updated, and workflow rules associated with the opportunity do run.
Lead Conversion
The before triggers associated with the following operations are fired during lead conversion only if validation and triggers for lead conversion are enabled in the organization:
- insert of accounts, contacts, and opportunities
- update of accounts and contacts
ContentVersion
- Content pack operations involving the ContentVersion object, including slides and slide autorevision, don’t invoke triggers.NoteContent packs are revised when a slide inside the pack is revised.
- Values for the TagCsv and VersionData fields are only available in triggers if the request to create or update ContentVersion records originates from the API.
- You can’t use before or after delete triggers with the ContentVersion object.
Attachment
Triggers on the Attachment object don’t fire when:
- the attachment is created via Case Feed publisher.
- the user sends email via the Email related list and adds an attachment file.
Triggers on the Attachment object fire when:
- Attachment records are created via Email-to-Case or via the UI.
The getContent and getContentAsPDF PageReference methods aren’t allowed in triggers.
Reference: Operations That Don’t Invoke Triggers