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
Jerun JoseJerun Jose 

Mail to Opportunity owner and sales team using templates

Hi,

 

I have a requirement where I need to send an email to the Opportunity owner and some sales team members (defined by the team role).

 

Is it possible to use an email template while doing this? I was able to do something similar using a workflow email alert, but this time, I need to send the email through Apex.

 

Any help is appreciated.

 

Thanks,

 

Jerun Jose

Jerun JoseJerun Jose

Thanks for the reply, but all the posts seem to indicate that the TargetObjectID can only be set to one user, contact or lead.

 

Even if I set the targetObjectID to the opportunity owner, how do I add the sales team users to the recepient list?

sanjdevsanjdev

You can make a query to the sales team  based on opportunity id/contactid/accountid and pass the userid to targetObjectID 

 

Mark it as resolved if it helps you.