Skip to main content

Notifications

Announcements

No record found.

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

Trying to add a toggle to the accounts form, that when selected as "Yes", turns on a visible counter that counts up

(0) ShareShare
ReportReport
Posted on by 42

Hello,

I am trying to do something that I keep running into walls over. I've created a new field on the "Accounts" form called "Am I late?" and it is a toggle switch with "Yes" or "No' options. What I would like is to have a time beside it, under it, on top of it, called "I am late by", which displays the total time since that "Am I late?" toggle was turned on. Is there anyway to:

1) Create such a timer

2) Link it to the "yes" option of the "Am I late" field?

  • Suggested answer
    Deekshitha Reddy Profile Picture
    Deekshitha Reddy 219 on at
    RE: Trying to add a toggle to the accounts form, that when selected as "Yes", turns on a visible counter that counts up

    I didn't get you, try referring to below image.

    time1 is the  time when you set the togggle true& time2 is the time when you open the page.

    pastedimage1682598231118v1.png

    Hope this helps.

    Thankyou

  • DevOs Profile Picture
    DevOs 42 on at
    RE: Trying to add a toggle to the accounts form, that when selected as "Yes", turns on a visible counter that counts up

    Hello Deekshitha,

    Thank you for replying. Am I supposed to use this within the formula option for a new field on the form?

  • Suggested answer
    Deekshitha Reddy Profile Picture
    Deekshitha Reddy 219 on at
    RE: Trying to add a toggle to the accounts form, that when selected as "Yes", turns on a visible counter that counts up

    Yes, It is possible. I coded on card page.

    field(AmILate; Rec.AmILate)//AmILate is of type Boolean

                   {

                       trigger OnValidate()

                       begin

                           IF AmILate= true then

                               Rec.time1 := Time;

                       end;

                   }

    trigger OnOpenPage()// Checks when the page opens

       begin

           if Rec.AmILate = true then begin

               Rec.time2 := time;

               Rec.Duration := Rec.time2 - Rec.time1;

               Rec.Modify();

           end;

    // Here time1 and time2 are fields of type time, Duration is a field of time duration.

    Please Let me know.

    Hope this Helps.

    Thankyou.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,569 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans