Automatically Send Greeting Email on Birthdays using Microsoft Flow

By | September 19, 2018

Recently we received a business requirement where client wants to send Birthday Emails to the CRM contacts. We tried this using Microsoft Flow. In this blog we will discuss this.

First we need to create a Recurrence trigger so that this functionality will run every day.

To create recurrence trigger in Flow please follow below steps:

1. Click on “Create from Blank” button as shown in below screenshot.

Automatically Send Greeting Email on Birthdays using Microsoft Flow

2. After clicking on “Create from Blank” below window will appear and then search for the Recurrence trigger once clicked on “Search hundreds of connectors and triggers”

Automatically Send Greeting Email on Birthdays using Microsoft Flow

3. Click on below trigger shown in the screenshot

Automatically Send Greeting Email on Birthdays using Microsoft Flow

4. Set Interval as ‘1’ and Frequency as ‘Day’ as shown below.

Automatically Send Greeting Email on Birthdays using Microsoft Flow

This is how the recurrence trigger will get created.

When the recurrence trigger gets created then you need to create Action to list all the Contact entity record from your CRM, you can follow below steps to create action.

1. Click on ‘New Step’ button and then ‘Add an action’ button as shown below

Automatically Send Greeting Email on Birthdays using Microsoft Flow

2. Then select Dynamics 365 and List records as shown below

Automatically Send Greeting Email on Birthdays using Microsoft Flow

3. Select the ‘Organization name’ from option set, Entity Name should be ‘Contact’ and Filter Query to filter the records from CRM (i.e. get the list of Active records only)

Automatically Send Greeting Email on Birthdays using Microsoft Flow

When the listing of all contacts from CRM is completed then we need to click on ‘Add an apply to each’ option, so that we can run the flow on every record. Follow below step to add and apply to each option in Microsoft flow.

Automatically Send Greeting Email on Birthdays using Microsoft Flow

Automatically Send Greeting Email on Birthdays using Microsoft Flow

After the above step add a condition to compare ‘Birthday’ date to ‘Todays’ date as shown below.

Automatically Send Greeting Email on Birthdays using Microsoft Flow

Automatically Send Greeting Email on Birthdays using Microsoft Flow

Use below fetch expressions in the condition attribute.

1. To get the Value from CRM Birthday field use below expression, this expression will format date time and convert date to MM/dd format.

formatDateTime(items(‘Apply_to_each_2’)?[‘Birthdate’], ‘MM/dd’)

2. To handle the Null Condition i.e. if the Birthdate field doesn’t contain any values then you need to modify the above formula as shown below

if(equals(items(‘Apply_to_each_2’)?[‘Birthdate’], null), ”,

formatDateTime(items(‘Apply_to_each_2’)?[‘Birthdate’], ‘MM/dd’))

3. Use “is equal to” operator for comparing the Date fields.

4. Then use today’s date to compare the CRM Birthday field Date

formatDateTime(utcNow(), ‘MM/dd’)

If the above condition matches then as shown in above screenshot you can Send Email to the Contact for which the condition is successful, otherwise it will ignore the process.

To send the email ‘To’ field is mandatory by using the below expression you will get the value of the field.

items(‘Apply_to_each_2’)?[’emailaddress1′]

You can provide Subject and Body of the email as per your specifications.

Yes condition will look like below screenshot

Automatically Send Greeting Email on Birthdays using Microsoft Flow

Conclusion:

Using the steps above the user can automatically send email greetings on birthdays using Microsoft Flow.

Generate Your Own New Leads Within Microsoft Dynamics 365 CRM

Contact us for a demo to know more about how Maplytics can help you to generate new leads from within Microsoft Dynamics 365 CRM.

Maplytics is a 5-star rated, preferred business app on the Microsoft AppSource that is Certified for Microsoft Dynamics 365 (CfMD) and comes with powerful features like Appointment Planning, Sales Routing, Territory Management, Heat Maps, Geo-analytical Dashboards and more that empower organizations to add more value to their CRM data, improve sales & service processes, and achieve high ROI.

Get your free trial from our Website or Microsoft AppSource!

‘If data is the new oil, location intelligence is ??”

4 thoughts on “Automatically Send Greeting Email on Birthdays using Microsoft Flow

  1. Mahesh

    Hi sir,
    I have tried the above logic but its saying: Action Failed- An action failed. No dependent actions succeeded.
    Please do the needful.

    1. Inogic

      Hello,

      I think the issue is because of the Null value in the birthdate field, Please use the expression below so it will handle the null values

      “if(equals(items(‘Apply_to_each_2’)?[‘Birthdate’],null),”,formatDateTime(items(‘Apply_to_each_2’)?[‘Birthdate’],’MM/dd’))”

      Instead of “formatDateTime(items(‘Apply_to_each_2′)?[‘Birthdate’], ‘MM/dd’)”

      Hope this helps.

      Thanks!

  2. ram

    Apply to each is not working it is showing expression in valid

    1. Inogic

      Hi,

      The issue which you have specified basically appears when the expression in the “Apply to each” condition is not appropriate. can you please specify the expression which you have used in the same condition So that we can dig more on the issue and let you know the proper answer.

      I hope you have used the below expression to validate if “Birthdate” field contains a date or not and if field contains date then convert that date into ‘MM/dd’ format.

      “if(equals(items(‘Apply_to_each_2′)?[‘Birthdate’],null),”,formatDateTime(items(‘Apply_to_each_2′)?[‘Birthdate’],’MM/dd’))”

      Hope this helps.

      Thanks!

Comments are closed.