web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help on building on a ...
Power Apps
Answered

Help on building on a productivity tracker

(0) ShareShare
ReportReport
Posted on by 28

Hi, I am fairly new to Power Apps and I'm tasked to create a productivity tracker with the following requirements:

1. Track and record time spent on each item.

2. Allow the time to be paused and resumed but only return the time spent on the task excluding the idle time in between. 

3. Allow to switch tasks in between. 

 

Currently, I was able to create the SharePoint List and the base App; however, I am having an issue on the 'timer'. The app includes a Gallery with 'Add Icon' which I am intending to use as the trigger to start the timer and record the current time using Now() but it's not working. I also intend to use the 'Check Icon' as SubmitForm to trigger end timer and record again using Now().

 

Here's a screen grab of my list and app. Hope someone can help out. 

ZERAREZ_0-1713227031960.png

 

ZERAREZ_1-1713227383160.png

 

Start Time

 

NewForm(Form1); UpdateContext({newMode: true});

Set(varNewItem,Patch('Test-UW DAR',Defaults('Test-UW DAR'),{Title: User().FullName,Start: Now(), 'Active Session': true}));

UpdateContext({VarTimerActive: true});
UpdateContext({VarTimerReset: false});

 

End Time

 

SubmitForm(Form1);

Set(varNewItem,Patch('Test-UW DAR',Defaults('Test-UW DAR'),{End: Now(), 'Active Session': false}));

UpdateContext({VarTimerActive: false});
UpdateContext({VarTimerReset: true})

 

Thanks in advance!

 

 

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,737 Most Valuable Professional on at

    Hi @ZERAREZ ,

    I am a little unclear as to whether you want two records here or want the start and end on the one record. I am assuming the second option for now. I also assume that the Start of your Timer is varTimerActive and the Reset is varTimerReset. So to start

    NewForm(Form1); 
    UpdateContext(
     {
     newMode: true,
     varTimerActive: false
     varTimerReset: false
     }
    );
    UpdateContext({varTimerActive: true});
    Set(
     varNewItem,
     Patch(
     'Test-UW DAR',
     Defaults('Test-UW DAR'),
     {
     Title: User().FullName,
     Start: Now(), 
     'Active Session': true
     }
     )
    );

    Now Submit the Form

    SubmitForm(Form1);
    UpdateContext({varTimerActive: false});
    

    and OnSuccess of the Form

    UpdateContext({varTimerActive: true});
    Patch(
     'Test-UW DAR',
     {
     ID: varNewItem.ID,
     End: Now(), 
     'Active Session': false
     }
    );
    UpdateContext(
     {
     varTimerActive: false
     varTimerReset: true
     }
    )

    The issue with a Timer is that its functions are triggered by a change in the Variable - so you need to reset them a couple of times.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ZERAREZ Profile Picture
    28 on at

    Hi Warren,

     

    Appreciate your quick response and help.

     

    Yes, you're correct to assume I just need to update 1 list. 

     

    I tried applying the formulas and updated some of the variables based on their names on the list; however, I encountered some issues as follows:

    1. After clicking submit, it shows an error message but also creates an incomplete record. here's a sample:

    ZERAREZ_0-1713312294174.png

    The Start and End times were not added and the Active session was not changed to NO.

     

    2. The error after submitting is:

    Network Error When Using Patch Function: Field ' ' is required.

    ZERAREZ_1-1713312454937.png

    As you can see, the list was updated but the error is still present. I researched on it and think it is due to the option below being turned on but, I can't turn it off since I need those data.

    ZERAREZ_2-1713312559626.png

    3. Here is the error showing on the formula, when I tried removing the field stated on the error in number 2, it now changed to another required field. 

    ZERAREZ_3-1713312658834.png

     

    So now I'm stumped on how the formula would actually update the Start and End columns and eliminating the error message. 

     

  • WarrenBelz Profile Picture
    153,737 Most Valuable Professional on at

    @ZERAREZ ,

    You have to turn off the requirement for EndA to have information or you will not be able to write the initial record. It will be populated once the Form is submitted.

  • ZERAREZ Profile Picture
    28 on at

    @WarrenBelz ,

     

    Actually both StartA and EndA have the requirement turned off. Fields that has the requirement turned ON are Title, Reference#, Cluster, Transaction Type and Status. 

    ZERAREZ_0-1713328385080.png

     

    Still showing this error 

     

    Is it required for me to turn them all off? 

  • WarrenBelz Profile Picture
    153,737 Most Valuable Professional on at

    @ZERAREZ ,

    You need to turn off anything you are not writing to in the initial patch - out of these, you are only writing to Title (as well as Start and 'Active Session' ), so you cannot have compulsory data on the other four (Reference#, Cluster, 'Transaction Type' and Status ).

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

  • ZERAREZ Profile Picture
    28 on at

    Thanks Warren, 

     

    I removed the Mandatory option on the items and just added that option on the App itself. It now updates the Start time and End time but having issues with the other columns. What I did is just to revert everything to SubmitForm instead and since what I only need is a date and a time on how long the process took, I used the timer's value instead of calculating elapsed the time between Start and End. 

     

    Thanks so much for the help!

  • WarrenBelz Profile Picture
    153,737 Most Valuable Professional on at

    @ZERAREZ 

    Any field that is not going to have data it it when you write a new record needs the requirement turned off.

  • ZERAREZ Profile Picture
    28 on at

    Hi Warren, 

     

    I applied what you just mentioned on a new App; however, the problem I'm encountering is the Start and End time is being saved on a different ID than the SubmitForm ID. 

     

    Is there a way that the data of SubmitForm will be saved on the ID of the first patch triggered or is this a limitation of using SubmitForm?

     

    ZERAREZ_0-1714373056813.png

     

  • Verified answer
    WarrenBelz Profile Picture
    153,737 Most Valuable Professional on at

    @ZERAREZ ,

    I assumed that you had a second list recoding the times - this is getting a bit more complex now. The first bit should still be correct

    NewForm(Form1); 
    UpdateContext(
     {
     newMode: true,
     varTimerActive: false
     varTimerReset: false
     }
    );
    UpdateContext({varTimerActive: true});
    Set(
     varNewItem,
     Patch(
     'Test-UW DAR',
     Defaults('Test-UW DAR'),
     {
     Title: User().FullName,
     Start: Now(), 
     'Active Session': true
     }
     )
    );

    but now you cannot submit your Form anymore - you need to patch it all.

    UpdateContext({varTimerActive: false});
    UpdateContext({varTimerActive: true});
    Patch(
     'Test-UW DAR',
     {
     ID: varNewItem.ID.
     End: Now(), 
     'Active Session': false
     },
     Form1.Updates
    );
    UpdateContext(
     {
     varTimerActive: false
     varTimerReset: true
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • ZERAREZ Profile Picture
    28 on at

    Yep only 1 list, apologies for the confusion. I thought so, making use of both may function may not be possible for this requirement. Thank you so much! 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 248 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 209 Super User 2026 Season 1

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 195

Last 30 days Overall leaderboard