function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jon SheaJon Shea 

TaskWhoRelation Query


Trying to write a trigger to update the LastActivity Date on contacts related to a completed task. We have Shared Activities enabled and I would like to get a list of all related contact IDs from TaskWhoRelation. 

This query works in Workbench - but in the DeveloperConsole I only get 1 contact Id returned (the primary contact): Select RelationID from TaskWhoRelations Where TaskID = ' xxxxxx'

 There is a known issue with triggers on Shared Activities:

So I guess this is just confirmation - but does anyone know if it is possible to get all the related contactIds from a task into a list ? Or is this just not possible. 

SandhyaSandhya (Salesforce Developers) 

As you said this known issue and I did not found any workarounds.

When you query TaskWhoRelation with any SOQL syntax via Apex
only the Primary Contact is returned:

Please refer below link.
Please mark it as solved so that it will make available for others as a proper solution.

Thanks and Regards