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
ChickenOrBeefChickenOrBeef 

Logged email tasks shared among all Contacts that were emailed?

Hello everyone,

If a logged email was sent to three different email addresses (as an example), we'd like to have a trigger that associates that Task to all three Contacts in Salesforce. I know we can manually associate a Task to multiple Contacts, but is this possible to do in Apex automatically? And if so, how would I go about writing the Name field to hold multiple Contacts?

Thanks!
-Greg
Best Answer chosen by ChickenOrBeef
Hargobind_SinghHargobind_Singh
Hi Greg, check out this object: https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_taskrelation.htm 

This could be the object you would need to insert the records to ? 

=====
ps: If your question/problem is resolved/answered, please mark your post as 'Solved' so that community can benefit by resolved posts.