Automate Birthday or Anniversary Email Using Salesforce Flow

Using Salesforce Flow, we can automate the process of sending emails to users or accounts on birthdays or anniversaries every year.

In this Salesforce tutorial, we will learn about how to automate birthday or anniversary Email using Salesforce Flow using real-time scenarios and explanations.

Let’s take a Scenario while working as a Salesforce Admin for a US-based Organization that provides software solutions. I was assigned the task of developing a flow. Whenever an employee’s birthday comes up, automate the process of sending him best wishes through an email every year.

Automate Birthday or Anniversary Email Using Salesforce Flow

Prerequisite: We need to create a Date field and a Checkbox field on the custom Employee_c object, and we have to create a formula for the checkbox so that when there is any employee’s birthday on that day, the checkbox should get checked, and the next day, it should again uncheck.

I have created a Date field named “DOB_c” and a Formula field with a Checkbox named “Is Birthday_c” on the Employee_c object so that it will be checked on the Birthday Date.

Formula:  IF(
                        AND( DAY( TODAY() ) = DAY( DOB__c ),
                                   MONTH(TODAY() ) = MONTH( DOB__c )), TRUE, FALSE)

This formula validates the DOB_c of the employee and checks the checkbox on every birthday.

Automate Birthday or Anniversary Email Using Salesforce Flow

Email Template: Create an email template we can use in the flow. Here, I have created a classic email template with dynamic fields that will display values in the mail body.

You can read the whole article on Various Ways to Use Classic Email Templates in Salesforce Flow.

How to Automate Anniversary Email Using Salesforce Flow

Create a Flow Schedule-Trigger flow:

1. Log in to the Salesforce Org. -> Click on the Setup. -> Home Tab. -> In Quick Find Box, Search for Flows. You will see an option under Process Automation. -> Click on Flows.

See also  How to Add Validation to Screen Flow in Salesforce

Click on the New Flow button to create a new flow.

2. We want to create a flow for sending an email in a particular frequency, so we have to select the Schedule-Trigger flow. Then, click on the Create button.

Now, we will create the following elements in the flow according to the flow diagram displayed in the following Flow Diagram.

How to Automate Birthday Email Using Salesforce Flow

1. Start:

3. Now select the Start Date and Time. From the selected date and time, the flow will start to execute. The Frequency is set to Daily because we want to execute this task on a daily basis. The Once is used when we want to execute this flow only once.

How to Automate Email Using Salesforce Flow

4. Now, we need to add objects and conditions to schedule the flow.

  • Object: Employee_c.
  • Is_Birthday = True: Only flow will execute if the Is_Birthday checkbox is checked.
  • Is_Birthday Not Equals to Null.
How to Automate Birthday or Anniversary Email Using Salesforce Flows

2. Email Action(Alert):

5. Now, we need to add Action after triggering the Flow with the condition we applied to trigger it. To add an action element, click on the + plus icon, and then you will see the Action Element. Then select Filter By Type and click on the Email Alert.

 6. As you click on it, you need to add Action in the Action field. To add an email alert, we have to select the Email Alert Name in action. Then, enter the Label, and the API Name will automatically populate.

7. We have to Set Field Values for the Selected Action. Here, we have to select EmployeeID.

Create a Flow to Automate Birthday or Anniversary Email in Salesforce

3. Get Records(Get Email Details):

8. Then, we need to fetch the Classic Email Template. For that, we need to select the Get Records element and enter a Label and API Name into it.

See also  Auto-Launched Flow in Salesforce | How to Create Auto-Launched Flow In Salesforce

In the Object field, select the Email Template object. To fetch the template, then copy the Email template’s unique name and paste it into the value field.

In the DeveloperName = Birthday_wish_to_employee (the API Name of the Classic email template). After this, leave the other fields as they are and click on the Done button.

Automate Anniversary Email Using Salesforce Flow

4. Create Records(Send Email):

9. Now, we get the Email Template. Then, we need to send emails to the employee, and for that, we have to Create Email Records.

Here, we need to select One record to create and Use separate resources and literal values to send an email.

How to Automate Email in Salesforce Flow

10. After that, we need to select Object as Email Message. Here, we need to Set Field Values for the Email Message as per the following values:

  • ToAddress: Here, we can select $Record -> Employee_c -> Email.
  • FromAddress: Select the sender’s email address. Here, I have selected the assigned email of the User of that record.
  • Subject: This will fetch from the Classic email template, which we get in Get Email Record as a Subject.
  • TextBody: This also gets from Get Email Record as an Email Body.
  • Status: In this field, we can select the status New, Sent, Read, Forwarded. Here, I have selected Sent. As we select that option, it will populate in numerical form.
Automate Email Using Salesforce Flow

5. Save:

11. After setting up all labels and conditions, click the Save button to save the flow. For that, we need to enter the Flow Label; the API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

See also  How to Create an Email Template In Salesforce Flow

6. Debug & Activate:

12. After Saving the flow, click on the Debug button. Then click on the Activate button; always remember to debug the flow before activating it. It’s good practice to use flow.

How to Automate Birthday Email Using Salesforce Flow

7. Proof of Concept:

13. After Activating the flow, let’s check how it is working; for that, go to the Employee object and select any Record to update. Here, I have updated the DOB of three records with Today(19/04). You can see that the Is_Birthday checkbox has been checked as I updated the DOB.

Automate Birthday or Anniversary Email Using Salesforce Flows

14. You can see I got an email with dynamic fields replacing record values.

How to Automate Birthday or Anniversary Email Using Salesforce Flow

This is how we can automate birthday or anniversary emails using Salesforce Flow.

Conclusion

Using Salesforce Flow, we can automate the process of sending emails to users or accounts on birthdays or anniversaries every year. In this article we have seen how to automate birthday or anniversary Emails using Salesforce Flow using real-time scenarios and explanations with proof of concept.

You may like to read: