Calculate Age in Dynamics 365 as Number of Years using Microsoft Flow

By | December 7, 2018

Introduction:

If we want to calculate the Age in a number of years using Birthdate field (i.e. Date type field) in CRM we can achieve this in multiple ways. Here we tried to achieve this functionality using MS Flow.

Below example is configured for contact entity and flow will trigger whenever the record is created in Contact Entity.

Go to Office 365 → Microsoft Flow

  • Click on ‘Create from Blank’ button, to create new Flow.
  • You will be redirected to below screen then click on ‘When a record is created’ option which is highlighted in below screenshot, to trigger Flow on create of Contact entity record.

  • After this you will be redirected to below screen, Please select Organization Name (Your CRM Organization) and Entity name (In this case we considered Contact entity)
  • After this, you need to add condition to check if Birthdate field is Empty or not to proceed.Below is fetch expression to validate the same.@empty(triggerBody()?[‘birthdate’])
  • We need to add an Action to update the record and calculate Age field value in a number of* years using from expression.To update record use highlighted action as shown in below screenshot:

After this you need to select Organization Name and Entity Name once again. Here we need to select one more field i.e. Record Identifier to uniquely identify the record which needs to be updated.

Follow below screenshot to set the Record Identifier, here we select Contact:

Click on ‘Show Advanced option’ as shown in below screenshot, to populate value of Age field:

Find Age field in list then click on “Add dynamic content” then add mentioned expression as below under “Expression” tab then click OK.

int(sub(int(formatDateTime(utcNow(),’yyyy’)),int(formatDateTime(triggerBody()?[‘birthdate’],’yyyy’))))

Conclusion:

Using the simple steps given above user can calculate the Age in Dynamics 365 CRM as a number of years 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 *