Automatically Send Greeting Email on Birthdays (Leap Year Scenario) using Microsoft Flow – Part 2

By | September 28, 2018

Introduction:

In one of our recent blog we saw, How to automatically send greeting email on Birthdays using Microsoft Flow.

In order to take customer relations to a next level, any company or establishment would surely like to greet their valuable customers regardless of whether they are born on 29 Feb or not.

This blog especially focuses to manage the Birthday wishes being sent out to clients who have their birthdays on 29 Feb via Microsoft flow.

Firstly, let’s discuss why we should use this approach:

The filter query of List records for Dynamics 365 Connector in Microsoft flow does not allow to filter the contacts on the basis of Birthday field with contains keyword, so one of the alternative ways was to retrieve all the contacts at once and then filter them but the limitation of 100000 records (even when pagination has been applied) also does not seems to fulfill the criteria to wish all of the customers (More than 100000).

So, in order to wish contacts beyond 100000 we have figured out the following way:

  • Create an alternative field for e.g. “Upcoming Birthday” and set its value when a new contact record is created in Dynamics 365 via Workflow.
  • While setting the value of this upcoming Birthday field make sure that you check whether the current year is a leap year by dividing it with 100 (In case of Centurial years) firstly and then with 400. If it’s divisible by both of them then it’s a leap year and if it’s not divisible by 100 but is divisible by 4 then also it’s a leap year.
  • Once you have figured out whether the current year is a leap year or not, set the “Upcoming Birthday” field accordingly i.e. if it’s a leap year then set the Upcoming Birthday field to 29 Feb else set it to 1st March and if the date is already gone then check whether the next upcoming year is leap or not and set the upcoming Birthday field accordingly.
  • Once we are done with setting the upcoming birthday field value for Contacts via normal workflow then we can proceed further to setup Microsoft flow.

Setup Microsoft flow:

  • Firstly, Set a Recurrence to run the flow on daily basis – It will retrieve only those contacts who have their Birthday on Today.

Quick Tip - Sending Birthday wishes to Contacts

  • Using List Records filter query retrieve records where Upcoming Birthday field contains today’s day and send them Birthday email

Quick Tip - Sending Birthday wishes to Contacts

  • After sending Birthday wish emails to them check whether the Birthday field contains 29 Feb :

If yes then check whether the next year is a centurial year and is divisible by both 100 and 400 also if it’s not divisible by 100 but divisible by 4 then also it’s a leap year and set the upcoming birthday field to 29 Feb else set it to 1st march

If no then simply increment the year (applicable for all other days apart from 29 Feb) and update the Upcoming birthday field.

Conclusion:

With the above approach, we can send Birthday wishes to Contacts having their Birth year as a leap year in Dynamics 365 using Microsoft Flow.

InoLink-QuickBooks-Integration-with-Microsoft-Dynamics-365-Dynamics-CRM

Leave a Reply

Your email address will not be published. Required fields are marked *