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 no of years using OOB Birthdate field in CRM we can use multiple ways here in this blog we tried to achieve this functionality using Microsoft Flow.

To calculate Age we have used contact entity, so this flow will trigger once the record is created in MS Flow

  • Click on ‘Create from Blank’ button.
  • You will be redirected to below screen then click on ‘When a record is created’ option which is highlighted in below screenshot.

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

  • After this you will be redirected to below screen, Please select Organization Name (Your CRM Organization) and Entity name (In our case we will be using Contact entity)

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

  • After this you need to add condition to check if Birthdate field is Empty or Not.

We have used below fetch expression to validate above condition

@empty(triggerBody()?[‘birthdate’])

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

  • If we find Birthdate field empty then we need to Add Action to update the record and set Age field value as ‘Birthdate field is Empty’

To update record use highlighted action as shown in the below screenshot.

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

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 identify the record which needs to be updated.

Please use below screenshot to set Record identifier.

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

Click on Advance Option and write Message in ‘Age’ field which you want to display if ‘Birthdate’ is empty.

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

  • Else we need to Add Action to update the record and set Age field value (Age in No of Years) from expression

We have used below expression to calculate the Age

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

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

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 *