When shared activities is on, task or event triggers that modify whoId or activity relations may not save correctly
Last updated 2019-03-23 ·Reference W-1444041 ·Reported By 142 users
As of Winter ‘13 the following known issue exists when the shared activities feature is enabled.
Any trigger that attempts to modify the who_id field on events or tasks OR attempts to add or remove event or task relations that represent related contacts may not save correctly or may not save at all when the trigger is fired during a UI save. The values for whoId or related contacts set in the UI will take precedence over the values set by the trigger.
Note that this issue...
… does NOT occur when attempting to add or remove event relations that represent event invitees.
… only occurs when the shared activities feature is enabled.
… can occur on any insert or update trigger event: before insert, before update, after insert, after update
Additional Scenarios affected by this issue(affects both Task and Event objects).
1. When a task is created and associated with multiple Contacts/Leads, the after Insert/update trigger does not reflect the correct count of the TaskRelation records and only the primary contact record appears when the TaskRelation object is queried. For example if you have 3 contacts associated with a Task, only the primary contact can be seen while the "after Insert/update triggers" is executing. The following query inside the trigger will return only one record instead of 3:
[Select TaskId, SystemModstamp, RelationId, IsWhat, IsDeleted, Id, AccountId From TaskRelation where tasked = :<newly created task ID>];
2. For task update, original "Name" field was Contacts with 5 different contacts. If you then update the task by selecting 'Lead' for the "Name" field and save, the TaskRelation shows 5 records with 4 of the 5 contacts and the new input Lead information instead of just 1 TaskRelation record for the lead when the after Insert/update trigger is executing (similar query as above).
One simple way to reproduce this issue is as follows:
- Create a trigger after insert on the Event object that sets whoId value to NULL
- In UI, create an event that is related to a contact C
- After UI save, the trigger should set the whoId value to NULL, so when the event detail page is viewed there should be no related contact
- The event detail page will still show the contact C as related to the event, because the UI save has take precedence.
No workaround at this time
Reported By (142)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.