Newer Version Available
Entity and Field Considerations in Triggers
QuestionDataCategorySelection Entity Not Available in After Insert Triggers
1QuestionDataCategorySelection[] dcList =
2 [select Id,DataCategoryName from QuestionDataCategorySelection where ParentId IN :questions];Fields Not Updateable in Before Triggers
- Task.isClosed
- Opportunity.amount*
- Opportunity.ForecastCategory
- Opportunity.isWon
- Opportunity.isClosed
- Contract.activatedDate
- Contract.activatedById
- Case.isClosed
- Solution.isReviewed
- Id (for all records)**
- createdDate (for all records)**
- lastUpdated (for all records)
- Event.WhoId (when Shared Activities is enabled)
- Task.WhoId (when Shared Activities is enabled)
* When Opportunity has no lineitems, Amount can be modified by a before trigger.
** Id and createdDate can be detected in before update triggers, but cannot be modified.
Fields Not Updateable in After Triggers
The following fields can’t be updated by after insert or after update triggers.
- Event.WhoId
- Task.WhoId
Considerations for Event DateTime Fields in Insert and Update Triggers
We recommend using the following date and time fields to create or update events.
- When creating or updating a timed Event, use ActivityDateTime to avoid issues with inconsistent date and time values.
- When creating or updating an all-day Event, use ActivityDate to avoid issues with inconsistent date and time values.
- We recommend that you use DurationInMinutes because it works with all updates and creates for Events.
Operations Not Supported in Insert and Update Triggers
The following operations aren’t supported in insert and update triggers.
- Manipulating an activity relation through the TaskRelation or EventRelation object, if Shared Activities is enabled
- Manipulating an invitee relation on a group event through the Invitee object, whether or not Shared Activities is enabled
Entities Not Supported in Update Triggers
- FeedItem
- FeedComment
Entities Not Supported in After Undelete Triggers
- CollaborationGroup
- CollaborationGroupMember
- FeedItem
- FeedComment
Considerations for Chatter Objects
- Only FeedItems of Type TextPost, LinkPost, HasLink, ContentPost, and HasContent can be inserted, and therefore invoke the before or after insert trigger. User status updates don't cause the FeedItem triggers to fire.
- While FeedPost objects were supported for API versions 18.0, 19.0, and 20.0, don't use any insert or delete triggers saved against versions prior to 21.0.
- For FeedItem the following fields are not available in the before insert trigger:
- ContentSize
- ContentType
In addition, the ContentData field is not available in any delete trigger.
-
Triggers on FeedItem objects run before their attachment and capabilities information is
saved, which means that ConnectApi.FeedItem.attachment information and ConnectApi.FeedElement.capabilities
information may not be available in the trigger.
The attachment and capabilities information may not be available from these methods: ConnectApi.ChatterFeeds.getFeedItem, ConnectApi.ChatterFeeds.getFeedElement, ConnectApi.ChatterFeeds.getFeedPoll, ConnectApi.ChatterFeeds.getFeedElementPoll, ConnectApi.ChatterFeeds.postFeedItem, ConnectApi.ChatterFeeds.postFeedElement, ConnectApi.ChatterFeeds.shareFeedItem, ConnectApi.ChatterFeeds.shareFeedElement, ConnectApi.ChatterFeeds.voteOnFeedPoll, and ConnectApi.ChatterFeeds.voteOnFeedElementPoll
- For FeedComment before insert and after insert triggers, the fields of a ContentVersion associated with the FeedComment (obtained through FeedComment.RelatedRecordId) are not available.
- Apex code uses additional security when executing in a Chatter context. To post to a private group, the user running the code must be a member of that group. If the running user isn't a member, you can set the CreatedById field to be a member of the group in the FeedItem record.
Considerations for the Salesforce Side Panel for Salesforce for Outlook
When an email is associated to a record using the Salesforce Side Panel for Salesforce for Outlook, the email associations are represented in the WhoId or WhatId fields on a task record. Associations are completed after the task is created, so the Task.WhoId and Task.WhatId fields aren’t immediately available in before or after Task triggers for insert and update events, and their values are initially null. The WhoId and WhatId fields are set on the saved task record in a subsequent operation, however, so their values can be retrieved later.