Author: Rishabh Dubey
Workflow rules or Process builder by themselves typically run once until a record is saved or edited in any way, in which case it is reset. So, creating a single workflow rule or process builder to email a customer on his or her next birthday is a fairly basic automation. The trick is to get it to reset every year. If you follow the below article provided by salesforce you will need to create 4 different workflow rules, Multiple custom fields and then only it will work on future records for existing contact records you need to use data management tools (Data Loader, Data Import wizard)
https://help.salesforce.com/s/articleView?id=000330629&type=1
However there is an easy alternative to this using Salesforce Flow. And the same can be done by 1 Salesforce Flow and 2 custom fields.
In this article we will see step by step process of creating a Flow to send Birthday Greetings every year.
Step 1. Create two Formula fields (Text) that will return Birthday Month and Birthday Day.
- Go to object manager
- Go to Contact Object
- Go to Fields and relationship
- Click new
- Select data type Formula
- Select return type and text and name the field “Birthday Month”
- The Syntax will be = “TEXT(MONTH( Birthdate ))”
- This field is not required on Page layout
- Follow the same steps for “Birthday Day” field and the Syntax will be =”TEXT(DAY( Birthdate ))”
Step 2. Create a Scheduled-Triggred-Flow
- Go to setup
- Go to Flows click on New flow from top right
- Select Scheduled-Triggered-Flow and then next
- Select free form layout
- Click on set schedule
- Select start date as Today and Start time as 8 AM. And frequency will be Daily
- Do not make any changes in Choose object section
- Drag get record element from right and drop on the Canvas
- Label = Get Contact Records
- Object Will be contact
- Condition Requirements = All Conditions are Met (AND)
Condition 1.
Birthday_Day__C Equal = We need to create a new resource
Resource Type = Formula
APIName = TodaysDay
Formula Syantx = TEXT(DAY(TODAY()))
Condition 2.
Birthday_Month__c Equal = We need to create a new resource
Resource Type = Formula
APIName = TodaysMonth
Formula Syantx = TEXT(MONTH(TODAY()))
- Sort Contact Records Ascending and sort By = ID
- How to store record data = Choose fields and assign variables (advanced)
- Select Variable to Store Contact Records = Select new resource
Resource Type =Variable
API Name = Customercontactforemail
Data Type = record
Allow multiple values (collection) = Check
Object = Contact
- Add fields firstname,lastname,email birthdate
- Drad Loop element
- Label =”Loop Through Contacts”,Collection variable = “{!Customercontactforemail}”,Direction first item to last
- Go to manager tab from top left and click on new resource
Resource type = Text Template
APINAME= Birthdaywish
Body =
Hi {!Loop_Through_Contacts.FirstName},
Wishing you a very happy birthday.
From
Rishabh Dubey,
S. Drag Action element to the canvas
Label = Send Email
Body = {!BirthdayWish}
Su ject = Happy birthday
Email Addresses (comma-separated)={!Loop_Through_Contacts.Email}
Rich-Text-Formatted Body = {!$GlobalConstant.True}
Sender Address=enter your email address
T. And Loop to action for Each Items and and action to loop Again
This is how the flow will look like
Save and Activate the flow.
This flow will run daily at 8 AM and will send the Birthday email to all the contacts who have birthdays on the same day.