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

Hello,

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: https://success.salesforce.com/issues_view?id=a1p30000000Su0FAAS

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. 

Thanks. 
SandhyaSandhya (Salesforce Developers) 
Hi,

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.

http://salesforce.stackexchange.com/questions/137395/when-shared-activities-are-enabled-querying-taskwhorelation-only-returns-the-pr
 
Please mark it as solved so that it will make available for others as a proper solution.

Thanks and Regards
Sandhya