0

I want to use an email template when I send an email via a flow. I am sending the email to users who are following a custom object's record. The email is successfully sending when I use the flow's simpleemail feature. I am not sure how to specify what email I want the template to go to when using an email alert. Is what I am trying to do possible? I feel that I should specify the project record's id in the input field for the email action because I need to display information about the project record in the body of the email.

  • so you are trying to send an email to the Chatter followers of some custom object? Where are they supposed to appear: in the To:, cc:, or bcc: address field? – cropredy Nov 12 at 18:18
  • My Community users can select Follow on records of a custom object. When I choose to run the flow and specify the custom object record that I want the followers notified about, I want to send a nice-looking email (template) to the followers with details about the record they are following. To do this, I need to somehow indicate who I want the alert to go to. Hopefully I am explaining the scenario. – Michele Kleinhomer Nov 12 at 18:28
  • presumably they should be on bcc list so one community user is unaware of the other's email address and you can avoid "reply all" – cropredy Nov 12 at 19:21
  • I want to send individual emails to the community members who are following a particular record. How do I get the community member's email to be used when sending an email alert? I don't want to send the message to all Community members. – Michele Kleinhomer Nov 12 at 20:48
  • That would then require a loop through the recipients to send it individually to each (instead of using bcc). Also, if you are using an email alert notice the recipients are not dynamic enough to pass a follower list at the time of sending the email. – Glen De Marcos Nov 12 at 21:01
1

EDITED 11/12/2019 1:17pm PST

To solve this usecase, query the EntitySubscription Object to gather the users who should receive the email and leverage the Flow Core Action: Send email (instead of the Simple Email)

Addition by Kleinhomer 11/13/19 3:45 PM EST: Because the custom object that I made the email template off of didn't have an email address associated with it to indicate who I wanted to send the email to (record's follower), I added an email address field to the custom object. When I looped through the followers of the custom object's record, I temporarily updated the email field on the record while in the loop. This allowed me to send the email template to each individual follower.

https://help.salesforce.com/articleView?id=flow_ref_elements_actions_sendemail.htm&language=en_us&r=https%3A%2F%2Fwww.google.com%2F&type=5

Option #2 Use invokable apex to send the email. The flow should pass the template name and the collection of users and apex would fire the sendEmail() function from the Messaging.SingleEmailMessage class.

.

  • That is an idea. I am first going to see if I can call a PB process from a Flow and pass it the parameters that will be needed to correctly send the email. – Michele Kleinhomer Nov 12 at 21:10
  • Flow can query EntitySubscription where ParentId = targetObjId - this would avoid invocable apex – cropredy Nov 12 at 21:11
  • The invokable apex is to set the recipients in the SingleEmail as email alert would not offer this possibility – Glen De Marcos Nov 12 at 21:12
  • 1
    Ah, right, Flow's Core Action Send an Email supports text templates but not Email Templates but otherwise, the core action can be used to send email to a specific recipient – cropredy Nov 12 at 21:17
  • @cropredy Do you know how to easily leverage templates using Flow's Core Action Send an Email? This might be the limitation that would make apex more attractive. – Glen De Marcos Nov 12 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.