-
What for setTargetObjectId is used while sending an email in salesforce?
What for setTargetObjectId is used while sending an email in salesforce?
Log In to reply.
Activity › Forums › Salesforce® Discussions › What for setTargetObjectId is used while sending an email in salesforce?
Tagged: Apex Code, Emails, SettargetobjectId, Single Email Message
What for setTargetObjectId is used while sending an email in salesforce?
Hi,
setTargetObjectId(targetObjectId) is used while sending email from Apex code using SingleEmailMessage.
Required if using a template, optional otherwise. The ID of the contact, lead, or user to which the email will be sent. The ID you specify sets the context and ensures that merge fields in the template contain the correct data.
Thanks.
Log In to reply.