Send birthday greeting using Salesforce Flow

  • February 18, 2022

Workflow rules or Process Builder typically run once until a record is saved or edited in any way, in which case it’s reset. 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 steps by Salesforce, you’ll need to create four different Workflow rules and multiple custom fields, and then it will only work on future records. For existing contact records. you need to use data management tools such as Data Loader and Data Import Wizard.

https://help.salesforce.com/s/articleView?id=000330629&type=1

However, there’s an easy alternative to this using Salesforce Flow. And the same can be done with one Salesforce Flow and two custom fields.

In this article, we’ll see the step-by-step process of creating a Flow to send birthday greetings every year.

Step 1. Create two formula fields (text) to return birthday month and birthday day.

  1. Go to object manager.
  2. Go to contact object.
  3. Go to fields and relationship.
  4. Click new.
  5. Select data type formula.
  6. Select return type and text and name the field “Birthday Month.”
  7. The syntax will be = “TEXT(MONTH( Birthdate ))”.
  8. This field isn’t required on page layout.
  9. Follow the same steps for “Birthday Day” field and the Syntax will be =”TEXT(DAY( Birthdate ))”.

Step 2. Create a scheduled-triggred-Flow

  1. Go to setup.
  2. Go to Flows and click on new Flow in the top right.
  3. Select scheduled-triggered-Flow and then next.
  4. Select free form layout.
  5. Click on set schedule.
  6. Select start date as today and start time as 8 a.m. The frequency will be daily.
  7. Don’t make any changes in choose object section.
  8. Drag get record element from right and drop on the canvas.
  9. Label = Get Contact Records.
  10. Object will be contact.
  11. 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 Syntax = TEXT(DAY(TODAY()))

    Condition 2

    Birthday_Month__c Equal = We need to create a new resource

    Resource Type = Formula

    APIName = TodaysMonth

    Formula Syntax = TEXT(MONTH(TODAY()))

  12. Sort contact records ascending and sort By = ID.
  13. How to store record data = Choose fields and assign variables (advanced).
  14. 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

  15. Add fields firstname,lastname,email birthdate.
  16. Drag Loop element.
  17. Label =”Loop Through Contacts”,Collection variable = “{!Customercontactforemail}”,Direction first item to last
  18. 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}

Subject = 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

Save and activate the Flow.

This flow will run daily at 8 a.m. and will send the birthday email to all the contacts who have birthdays on the same day.

— By Rishabh Dubey