• Sreekanth Kalluru 18
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

 Creating a Task with more than one contacts associated with it.
Written a after insert trigger on Task and trying to get TaskWhoRelations for that task but it is giving only one Contact.

User-added image

 
trigger TaskTrigger on Task (after insert) {

List<Task> tasks=[Select WhoId, WhatId, (Select Id, RelationId, TaskId From TaskWhoRelations) From Task where id  IN : Trigger.NewMap.keySet()];

for(Task t:tasks)
{

System.debug('################'+t.TaskWhoRelations);
System.debug('################'+t.TaskWhoRelations.size());
}

}



**Any help is really appreaciated. 
Thanks in advance.


Thanks,
Naveen.