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
Nirmal VasanthakumarNirmal Vasanthakumar 

Send Email With TargerObjectId as Person Account

Hi,

I am trying to send Email via Messaging.MassEmailMessage by  setting TargetObjectIds method.  Even though it specifies TargetObjectIds to be a list of IDs of the contacts, leads, or users to which the email will be sent.

 

I want to ensure whether PersonAccountId can be set to TargetObjectIds to send mass email.

Ashish_SFDCAshish_SFDC

Hi Nirmal, 

 

I dont think this is currently possible, Vote for the Idea on the link below which will be considered for future releases. 

 

Need ability to assign Person-Account Id in the TargetObjectId field of a Single

 

https://success.salesforce.com/ideaView?id=08730000000BrJG

 

Regards,

Ashish

 

 

 

 

Swapnadip123Swapnadip123
Use this (PersonContactId instead of id) for PersonAccounts:
 
Account recipient = [SELECT id,PersonContactId FROM Account where id=<acc id>];
email.setTargetObjectId(recipient.PersonContactId);

Mark it as the best answer!