Compute the age based on the date of birth - Pipedrive x Make

Hi. We have a date of birth and age field in Pipedrive. We want to auto-compute the age based on the date of birth. Can someone share a guide? Thank you

Hi @aamag

You can use the below formula if your date is same like below “12-07-1993” .
{{get(split(formatDate(now; “MM-DD-YYYY”); “-”); 3) - get(split(“12-07-1993”; “-”); 3)}}

MSquare Support
Visit us here
Youtube Channel

2 Likes

Instead of split, you can also do this:

{{formatDate(now; "YYYY") - formatDate(parseDate("1994-02-14"; "YYYY-MM-DD"); "YYYY")}}

Explanation

Step 1

Parse input date string into a date type using the Date Format Tokens

{{parseDate("1994-02-14"; "YYYY-MM-DD")}}

Step 2

Get year of birth passing step 1 into formatDate function

{{formatDate(parseDate("1994-02-14"; "YYYY-MM-DD"); "YYYY")}}

Step 3

Get current year using formatDate

{{formatDate(now; "YYYY")}}

Step 4

Combine all steps, use - to subtract year of birth from current year

{{formatDate(now; "YYYY") - formatDate(parseDate("1994-02-14"; "YYYY-MM-DD"); "YYYY")}}

Output bundle

Screenshot_2023-09-11_120940

3 Likes

Hi @samliew Thank you so much for the detailed explanation. Though can you let me know how to get to that point? From Pipedrive trigger.

You just have to put this formula in whichever field you want to map the age into, and replace 1994-02-14 in my example with the variable from where you’re storing the date of birth string, and change the format YYYY-MM-DD to match the format of the date of birth input.

If you need more help, perhaps exporting the blueprint might help others replicate the issue to be able to answer your question.

At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826

Uploading it here will look like this:

blueprint.json (123.4 KB)

2 Likes

blueprint (1).json (72.8 KB)

Hi @samliew Thanks for explaining further. Here’s the blueprint. Can you please check? Thank you.

Hi @samliewmake Thanks for explaining further. Here’s the blueprint. Can you please check? Thank you.
blueprint (1).json (72.8 KB)

From your blueprint, I can see that you haven’t changed the example hard-coded/static date of birth to the variable coming from your trigger

Could you please make the change first, then provide a screenshot of the fields in your modules, and/or provide the output bundles of the module by running the scenario, then clicking here and copying the contents:

Screenshot_2023-08-29_100800

This will allow others to better assist you. Thanks!

2 Likes

Hi @samliew Sorry for getting back late.
I just have a clarification on this initial set up you shared. Are you saying we should have a Year or birth and current year field in Pipedrive for this to work? We don’t have those fields and I think that’s too manual to input for the client.
image

@samliew This is still aamag. I’m just using another account.

No, variables 1-3 are just showing you each step. The last one is all combined - just do that.

2 Likes


blueprint (2).json (72.9 KB)

Hi @samliew here’s an updated trial. Can you please check? Thank you

The age field looks correct, but I don’t have a Pipedrive connection, so I can’t test your scenario.

Your error message seems to be unrelated to the question. You should create a new question and add your screenshots of the modules, input/output bundles there.

2 Likes

Hi @samliew Got it. Thank you so much for the help!

2 Likes