hi i'm new to salesforce may i know how to send mail alert for birthday remainder ? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
dhinesh pitchaidhinesh pitchai 

hi i'm new to salesforce may i know how to send mail alert for birthday remainder ?

hi i'm new to salesforce may i know how to send mail alert for birthday remainder ?
Grazitti Interactive™Grazitti Interactive™
Hi, 
You can follow below steps to do so:


1 - Create an email template for the Birthday Email.

2 - Create a checkbox field:

1 - We'll call this field "Receive Birthday Emails" for the purposes of this article

2 - Default should be "Checked"

3 - Add it to all applicable page layouts so that all can see it (this will allow contacts to opt-out of the email)
 
3 - Create another checkbox field:​

1 - We'll call this field "Reset Birthday Email System"

2 - Default should be "Checked"

3 - Keep out of ALL page layouts; this should only be worked on by our workflow rules we'll create.

4 - Read only for everyone
 
4 - Create a Date field:

1 - We'll call this field "Next Birthday"

2 - Leave "Default Value" blank

3 - Like "Reset Birthday Email System", we'll keep this out of ALL page layouts and keep it read only for everyone.
 
5 -- Create a Workflow Rule:

1 - ​We'll call it "Send Birthday Email".  This will be the rule that will send the actual email, and then triggers (1 day later) the Birthday Reset process.

2 - For the Object to create the Workflow on, select "Contact."  This will be the same for all workflow rules in this article.

3 - The Evaluation Criteria should be "created, and any time it's edited to subsequently meet criteria."

4 - In the first line of Rule Criteria, input: "Receive Birthday Emails" equals "True"

5 - In the second line of Rule Criteria, input: "Reset Birthday Email System" equals "False"

6 - In the third line of the Rule Criteria, input: "Birthday" not equal to "" (leave the third column completely blank)

6 - Click Next.

6 - Add a Time Trigger and Action:

1 - ​Click Add Time Trigger.

2 - Set the trigger for 6 Hours after Contact: Next Birthday and click Save. (Note: if you need the email before the birthdate, select amount of time before Next Birthday instead.)

3 - Click Add Workflow Action | New Email Alert

4 - Type in a Description.  For Unique Name, we'll call it "Birthday Email".

5 - Select the Email Template you created in Step 1.

6 - In the Search field within the Recipient Type section, select Email Field

7 - Select "Email Field: Email" and click Add.​

Note: This will not work when the workflow is created on Account object, which is required when Person Account is enabled. Although there is a standard email field on Account when person accounts are enabled, this field cannot be used in email alerts.
               As a work around, we can create a custom Email field on Account object and make it hidden for all profiles except system admin. To update the Person Account Email field’s value in it, we can create another workflow with Field update action

7 - Add Another Time Trigger and Action:

1 - Click Add Time Trigger.

2 - Set the trigger for 30 Hours after Contact: Next Birthday and click Save

3 - Click Add Workflow Action | New Field Update

4 - Let's call it "Check Reset Birthday Email System Box"

5 - Be sure to check the box labeled Re-evaluate Workflow Rules after Field Change

6 - The Field to update is what we called "Reset Birthday Email System"

7 - Under "Checkbox Options", select "True"
 
8 - Create a Second Workflow Rule:

​1 - We'll call it "Reset Birthday Email".  This will be the rule that sets "Next Birthday" for the next birthday after the current date, then triggers the "Send Birthday Email" Workflow rule.

2 - The Evaluation Criteria should be "created, and any time it's edited to subsequently meet criteria."

3 - In the first line of Rule Criteria, input: "Receive Birthday Emails" equals "True"

4 - In the second line of Rule Criteria, input: "Reset Birthday Email System" equals "True"

5 - Click Next.
 
9 - Add a Field Update:

1 - Under Immediate Actions, click Add Workflow Action | New Field Update

2 - For the Name, let's call it "Reset Next Birthday".  This will actually set the Next Birthday field with the new value that represents the next birthday.

3 - For Field, select Next Birthday.

4 - Leave the Re-evaluate Workflow Rules after Field Change checkbox unchecked.

5 - Select Use a formula to set the new value, and Show Formula Editor
 
For Account/Contact:
 
IF(DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)) <= TODAY(), DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate)), DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)))
 
For Person Accounts:
 
IF(DATE(YEAR(TODAY()),MONTH(PersonBirthdate),DAY(PersonBirthdate)) <= TODAY(), DATE(YEAR(TODAY())+1,MONTH(PersonBirthdate),DAY(PersonBirthdate)), DATE(YEAR(TODAY()),MONTH(PersonBirthdate),DAY(PersonBirthdate)))
 
10 - Add a Time Trigger:​Click Add Time Trigger.

1 - Set the trigger for 1 hour after Rule Trigger Date.  This is to ensure that this action happens after changing the Next Birthday field.

2 - Add a Field Update.  Select the Field as Reset Birthday Email System.

3 - Check the Re-evaluate Workflow Rules after Field Change box.

4 - Select Checked is False

5 - Click Save. 
 
11 - Create a Third Workflow Rule

1 - Let's call this workflow rule "Birthday Email Opt-Out".  This will check the Reset checkbox when a user discontinues the email for a contact, so that if the contact wants the email again (sometime later), the Next Birthday field is properly reset before giving out an email on the wrong date.

2 - This workflow rule will be Evaluated Every time a record is Created or Edited (the 2nd option)

3 - Rule Criteria: "Receive Birthday Emails" equals "False"

4 - Click Add Workflow Action | Select Existing Action

5 - Under "Search:", select "Field Update"

6 - Select Field Update: Check Reset Birthday Email System Box and click Add, then click Save
 
​12 - Create a Fourth (and final) Workflow Rule

1 - Let's call it "Birthday Change".  This rule takes care of the unlikely event that a contact's Birthdate field changes - we trigger our second Rule, so as to reset Next Birthday to reflect the new date.

2 - This workflow rule will be Evaluated Every time a record is Created or Edited (the 2nd option)

3 - Rule Criteria: Use a formula : 
 
For Account/Contact:
 
(MONTH(Birthdate) <> MONTH(Next_Birthday__c) || DAY(Birthdate) <> DAY(Next_Birthday__c)) && Receive_Birthday_Emails__c = True
 
For Person Accounts:
 
(MONTH( PersonBirthdate ) <> MONTH(Next_Birthday__c) || DAY(PersonBirthdate) <> DAY(Next_Birthday__c))
 
4 - Click Add Workflow Action | Select Existing Action

5 - Under "Search:", select "Field Update"

6 - Select Field Update: Check Reset Birthday Email System Box and click Add, then click Save
​13 - Activate all Workflow Rules

1 - Go to Setup > Create > Workflow & Approvals > Workflow Rules.  Click "Activate" next to each of the four new workflow rules.  This allows the workflow rules to actually run.
14 - Verification: before enabling for all contacts​ 

1 - NOTE:This step is not technically necessary, but recommended to ensure that all emails are scheduled properly.

2 - Create a test contact on an account.  Add an email field and keep the "Receive Birthday Emails" box checked.  Set the contact's birthday to Tomorrow.

3 - Monitor the Time Based Queue (see Monitoring the Workflow Queue) You should see 1 Workflow in the queue for your contact, for the workflow "Reset Birthday Email", set for 1 hour from now.

4 - Wait approx. one hour.  After this rule executes, you should see 2 workflow rules in the queue, one scheduled at 6am on the Contact's birthday, and another scheduled 6am the next day, both for the rule "Send Birthday Email".

5 - If desired, you can do further verification the next day, that the email get sent, and then the next day at 6am, the Reset workflow should trigger and set Next Birthday to next year, and one hour later (7am), 2 more Workflow rules will be in the queue.

6 - When satisfied with verification, move on to Step 15.
 
15 - Enable All contacts to Receive Emails

1 - ​In order for any existing contacts to receive birthday emails, run a report that returns all contacts for which you'd like this feature enabled (note you may need to create a custom report type that includes just Contacts), and include these three fields: Contact ID, Receive Birthday Emails, and Reset Birthday Email System.

2 - Export the details of the report and open the document as a spreadsheet, and change ALL 0s to 1s and save as CSV.  Then import them back in using the Import Wizard as detailed in this article.

3 - Due to the time-based queue limitations, the time it takes for the initial reset and scheduling of the birthday emails will vary depending on how many contacts are in your system.  The limit for time-based workflow action execution is 500 per hour, including any other time-based workflow action that may be in your system.


Please Mark this as Answer if it helps you

--
Regards,
Grazitti Team
Web: www.grazitti.com
Email: sfdc@grazitti.com
 
shabbir skshabbir sk
Hi Dinesh,

please check this link,
https://help.salesforce.com/apex/HTViewSolution?id=000175696&language=en_US
RAJKUMAR MUTHUSAMYRAJKUMAR MUTHUSAMY
Dhinesh,

Simply give a try with the Birthday eMailer app , It is developed by Salesforce Labs

It won't support with professional edition, 

Also it's an unmanaged package you can modify the code as you need and modify the email template too.