Advertisements

Show all Contacts whose Birthday falls this week in Microsoft Dynamics CRM 2016/ 2015 Online Update 1

I came across this interesting requirement today and hence thought of penning down the solution. Please note this solution is for only for CRM 2015 Online Update 1/ CRM 2016. This solution does not target versions below that.

So from the title of the topic, the requirement is very obvious. I need a view which would show all contacts who birthdate falls this week.

So let us together see, how we can reach a solution here.

  • · First I create a new field of type datetime called ‘Date of Birth’. You might be wondering there is already an existing called Birth Day in the contact form. Then why I did not use it? There is a reason for this. I will come back to this. As of now just keep going here. Below is the screenshot for the schema definition for this Date of Birth field.

clip_image002

  • · Now create a new field called Age of type Whole Number. This would be a calculated field. Below is the screenshot of the calculation for the age field.

clip_image004

  • · Create another field called ‘Upcoming Birthday’. The field would be of type ‘Date and Time’ and will also be a calculated field. The schema and calculation formula of the field is shown in the screenshot below.

clip_image006

clip_image008

  • · All set and done. Before you leave customizations window, make sure you put the custom field ‘Date of Birth’ on the contact form to capture date of birth of the contact and remove OOB field. Thinking again WHY? Don’t worry I won’t leave in you dark. Will come back to this.
  • · Now all you are left is create a view for the contacts with the following view definition

clip_image010

And voila you are done! Wasn’t that easy.

Now coming to the topic, why I did not use the OOB Birth Date field of the contact entity. The reason is because for age calculation I needed to use the Now() function (you can refer to the above screenshots). This Now() function can only be used with date time fields which have a behavior of ‘User Local’. The OOB Birth Day field has a behavior of Date only and hence we could not use it.

Hope this helps! Happy CRMing.

Advertisements

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

4 Responses to Show all Contacts whose Birthday falls this week in Microsoft Dynamics CRM 2016/ 2015 Online Update 1

  1. Danylo says:

    Hello!
    Can you explain how we can use this functionality if contact’s birthday have passed, please?
    Field “Upcoming Birthday” will not update after contact’s birthday correctly. If my contact has “Birthday” 04/07/1995, so his/her “Upcoming Birthday” was “04/07/2017”. But after 04/07/2017 it wasn’t updated to 04/07/2018.

    • Debajit says:

      Hi Danylo,
      Sorry for the delayed reply.
      Upcoming birthday is a calculated field which is dependent on another calculated field called Age.
      Taking your example, say the persons age was 20. Now when 04/07/2017 crosses, the person’s age would automatically be increment to 21. Since upcoming birthday is dependent on the age field, it would automatically start showing the new date.

      -Debajit

  2. archikhurana says:

    it fails in case of leap year , if D.O.B 29.02.16 so upcoming birthdate should be after 4 years i.e 29.02.20 .Please suggest the solution in case of leap year

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: