Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Show days, months and year in one field

Posted on by Microsoft Employee

Hi all,

I would like to know that is it possible to show the calculated Day, Month, Year  in one field on the form.

I mean that is the difference between two dates is in days then it should show no. of days. 

If the difference between two dates is in months the it should show no. of months and so on.

I have no idea how can I bring a best solution for this. Please let me know if there is solution.

Thank you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Show days, months and year in one field

    Hi Leah,

    Thank you so much for the response.

    I am trying to do replicate exactly as you explained. But, my requirement is I need to see all Year,Month,Day in one field.

    Can I concat the fields to show in one field.

    for example :   I have one day it shows only 1day

                      If its 1month and 2days it should also show that.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Show days, months and year in one field

    Hi Sravz,

    You can achieve it through calculated fields and business rule.

    Steps:

    1.Create custom fields and add them to the form:

    (1)Three calculate fields to store difference in years/months/days.

    pastedimage1645511739246v5.png

    pastedimage1645510905188v3.png

    pastedimage1645511910504v6.png

    (2) Uncheck 'Visible by default' option for these three fields in the form.

    pastedimage1645513096572v8.png

    2.Create a business rule to populate 'Result' field automatically.

    pastedimage1645513017621v7.png

    IF

    Years greater than 0

    THEN
    Show field Years
    Hide field Months
    Show field Days
    ELSE IF

    Months greater than 0

    THEN
    Show field Months
    Hide field Years
    Hide field Days
    ELSE
    Show field Days
    Hide field Years
    Hide field Months

    3.Test Result:

    pastedimage1645513371260v9.png

    Change date and save current record:

    pastedimage1645513395306v10.png

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Show days, months and year in one field

    Hello,

    If you want to have something like that I would recommend creating a PCF control for that purpose.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans