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
Sandrine94748Sandrine94748 

Select records from related list and send email to contacts linked in the object

Hello,

I have a junction object between and contact and a custom object like below

Custom_object_X__C
- Id

Jucntion__c
-Id
- LookUpToJCustom_object_X__c
-LookUpToContact__c

Contact
-Id

On the custom object there is a related list of Jucntion__c, so in page layout it is like below

Record of Custom_object_X
- Name
- Picklist X
- ......
- ....
>Related list 1
>Related list to display Jucntion (This related list will also display the contact it is related to in one of the column)

Use case:
I want a custom button to select few records of junction and send an email to contacts. also if possible to select the emil template of choice

Like below, we are abe to select the quote, simillarly i want to able to select the records on junction object and send email to Quote
User-added image 

thanky you for sugetion
 

Best Answer chosen by Sandrine94748
PrabhaPrabha
There is a couple of ways you can do this:

1. I see that you are using classic and if your client is comfortable with quick and dirty way, I'd recommend this: https://success.salesforce.com/answers?id=9063A000000e3WCQAY

2. The other approach is is to create a Visualforce page: 
  • This is a related list like a Vf page that is embedded in the page with one or two additional buttons to send email.
  • you will embed this at the bottom of the Detail page
  • On the VF page, there is list of related records, this is a custom pageblock table with a wrapper checkbox.
  • This VF will have an extension class method that gets invoked on the click of custom button 'Send Email'
The second approach will work as long as the Vf pages are supported, 

The first approach will not work when you move to lightning, may be you can look for a lightning component at that time ;)

HTH,
PrabhaN

All Answers

PrabhaPrabha
There is a couple of ways you can do this:

1. I see that you are using classic and if your client is comfortable with quick and dirty way, I'd recommend this: https://success.salesforce.com/answers?id=9063A000000e3WCQAY

2. The other approach is is to create a Visualforce page: 
  • This is a related list like a Vf page that is embedded in the page with one or two additional buttons to send email.
  • you will embed this at the bottom of the Detail page
  • On the VF page, there is list of related records, this is a custom pageblock table with a wrapper checkbox.
  • This VF will have an extension class method that gets invoked on the click of custom button 'Send Email'
The second approach will work as long as the Vf pages are supported, 

The first approach will not work when you move to lightning, may be you can look for a lightning component at that time ;)

HTH,
PrabhaN
This was selected as the best answer
Sandrine94748Sandrine94748
Hi Prabha,
thank you for answering
Is it possible to send me some links or info related to your second answer.
 
PrabhaPrabha
Here it is: 
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_custom_controller.htm

You might want to change that to a standard controller with extension to add it on account page.

PrabhaN