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
Louis-Paul ValadouxLouis-Paul Valadoux 

Send an email to all selected contacts with inside all the opportunities related to this contact

Hello,
I have two custom tables (opportunity__c and Pipe_Owner__c).
When an opportunity is created, it should be linked to only one Pipe Owner. 
I would like to create a custom button on the Pipe Owner table which send a separate custom email to all of the selected owners. In this email I would like to have the list of all related opportunities that are linked to this owner.

e.g : 
Dear XXX, 
Please find below your open pipe:
Opp 1 | Account Name | Amount
Opp 2 | Account Name | Amount
etc..

I'm new to the Salesforce environment, but now I have done the following:
- Create a custom button which is launching a VisualForce page and sending an email to myself (but with hard coded values)

I would like now to be able to send one separate email to each of selected records with inside the body the opportunities related to this record. How can I do that ? Do you have some sample code or documentation ?

I'm using lightning version. 

Many thanks,
Akhil ReddyAkhil Reddy
1. Create a custom listview/table in the VF page
 - Get Associated Opp record information (Owner and associated Email)
 - Create Check box in the list view (you need wrapper class to do this
2. Handler/Controller class
- handle the check boxes in a methos where if the check box is on then send an email to related opp owner email.