No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Entity and Field Considerations in Triggers
QuestionDataCategorySelection Entity Not Available in After Insert Triggers
The after insert trigger that fires after inserting one or more Question records doesn’t have
access to the QuestionDataCategorySelection records that are associated with the inserted Questions. For example, the following
query doesn’t return any results in an after insert trigger:
1QuestionDataCategorySelection[] dcList =
2 [select Id,DataCategoryName from QuestionDataCategorySelection where ParentId IN :questions];Fields Not Updateable in Before Triggers
Some field values are set during the system save operation, which
occurs after before triggers
have fired. As a result, these fields cannot be modified or accurately
detected in before insert or before update triggers.
Some examples include:
- 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
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
Certain objects can’t be updated, and therefore, shouldn’t
have before update and after update triggers.
- FeedItem
- FeedComment
Entities Not Supported in After Undelete Triggers
Certain objects can’t be restored, and therefore, shouldn’t
have after undelete triggers.
- CollaborationGroup
- CollaborationGroupMember
- FeedItem
- FeedComment
Additional Considerations for Chatter Objects
Things to consider about FeedItem and FeedComment triggers:
- Only FeedItems of Type TextPost, LinkPost, and ContentPost 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 information is saved, which
means that ConnectApi.FeedItem.attachment information may not be available in the trigger.
The attachment information may not be available from these methods: ConnectApi.ChatterFeeds.getFeedItem, ConnectApi.ChatterFeeds.getFeedPoll, ConnectApi.ChatterFeeds.postFeedItem, ConnectApi.ChatterFeeds.shareFeedItem, and ConnectApi.ChatterFeeds.voteOnFeedPoll.
- 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.
Note the following for the CollaborationGroup and CollaborationGroupMember objects: