0

Let's say in Salesforce lightning I want to setup an automation email to all contacts of an Account, on a custom date field that is in "Account"

I know that I need to create a classic email template, an email alert, and daily-repeated flow to send it out. Right now I created a Classic Email Template.

My question would be when I create an Email Alert, should I select object "Account" ? and what would be the recipients type I should select?

I searched for a while and cant get the answer, my setup would be similar to this: Send Email To Related Contact of Account When Opportunity Close
But that case is regarding to "Opportunity" so it is not useful in my case.

If anyone knows some tutorial page for this I would appreciate it as well.

Thanks in advance for the help.

Regards, K


20230621 Update.

Here is my current setting:

Flow Schedule Triggered Flow
Start Date: 06/19/2023
Start Time: 12:00:00
Frequency: Daily

Choose object and Filter Condition:
"Account"
Condition: (checkbox field, when senddate match today) Sendtoday = True

node 1: New Get Records-
Object:Contact
Condition: AccountID equals {!$Record.Id}

node 2: Loop
Collection Variable: {!get_Contact}

node 3: Action-
(Email Alert that set)
Record ID: {!loop.id}


1 Answer 1

0

RecipientType for Email Alerts has to resolve to

  • A field on the target object of type Email
  • A related record of the target object using a standard lookup field to User, Lead, or Contact (as those standard objects have OOTB Email fields)
    • e.g. Opportunity.ContactId, Task.WhoId, Case.ContactId
  • OwnerId of the target object (this resolves to the User.Email field at runtime)
  • Some special cases for groups, roles, teams (members of whom are users who have User.Email field values)

The target object of the Email Alert is used to scope the available merge fields. If using VF email templates, it maps to the relatedToType.

In your example, the Email Alert target object should be Contact and the recipientType would the Email Field: Email. If you need merge fields from the parent Account, there are limitations on using cross-object merge fields and you may need to create formula fields on Contact for use in the template

6
  • Thanks for your reply. If I select "Contact" as target object. It got a error message that "given sobject does not match type for alert: Contact". I use a schedule trigger flow, repeat daily, object is "Account", condition is "If Orderdate = today"
    – Henry Chan
    Jun 20 at 23:28
  • I mean "LastOrderDate", which is a custom formula date field in "Account"
    – Henry Chan
    Jun 20 at 23:37
  • 1
    please use edit on your OP and show your configuration for the Flow Email Action - the Email Action RecordId has to be of the same type as the Email Alert target object
    – cropredy
    Jun 20 at 23:57
  • Note that Summer 23 allows use of email templates in Send Email action which eliminates reliance on Email Alerts
    – cropredy
    Jun 21 at 18:11
  • I updated my flow setting @cropredy Thanks for your help in advance.
    – Henry Chan
    Jun 22 at 0:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .