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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Best way to submit and...
Power Apps
Unanswered

Best way to submit and retrieve accumulated time to a SharePoint list column

(1) ShareShare
ReportReport
Posted on by 212

I have a timer control on a powerapp and want to submit and retrieve its accumulated value to a SharePoint list column. I've looked at Shane Youngs vid here and it gets close but doesn't answer my question.

To clarify:

1. User clicks Timer button while using app.

2. User clicks Save Changes btn

3. Timer value is submitted to SharePoint list column (date/time or just text?)

4. User reopens form and previous time populates the timer (the timer is not reset to 00:00:00 and is set with the SP list columns time).
I'm using a patch to submit the controls of the form to the SPO list and here is the code I'm using so far - this only saves to a text column so is not working as intended:

Patch(
 OnGoingCases,
 LookUp(
 OnGoingCases,
 ID = varActualCase
 ),
 {
 Time: Timer.Text,
 },
 MyNotesAttachmentsForm.Updates
);

 

 

 

Categories:
I have the same question (0)
  • Hassan_SZ_365 Profile Picture
    542 on at

    Hi,
    To submit and retrieve the accumulated time to/from a SharePoint list column using a timer control in Power Apps, you can follow these steps:

    Convert the timer's value to a format that can be stored in SharePoint. If you use a text column, make sure you store the time in a consistent format that you can easily convert back to the timer format.

    Use the Patch function to submit the timer value to the SharePoint list, converting the timer's milliseconds value to a suitable format.

    When retrieving the time value from SharePoint to populate the timer, you'll need to convert it back to the format the timer expects (usually milliseconds).

    Here's an example of how you might code this:

     

    // To start the timer
    UpdateContext({varTimerRunning: true});
    
    // To stop the timer and save the time
    UpdateContext({varTimerRunning: false});
    Patch(
     OnGoingCases,
     LookUp(
     OnGoingCases,
     ID = varActualCase
     ),
     {
     Time: Text(Timer1.Value / 1000 / 60, "[$-en-US]0") // Converts milliseconds to minutes and formats as text
     },
     MyNotesAttachmentsForm.Updates
    );
    
    // To read the value back into the app when opening the form
    Set(
     varPreviousTime,
     LookUp(
     OnGoingCases,
     ID = varActualCase
     ).Time
    );
    
    // To convert the retrieved value back to milliseconds and start from there
    UpdateContext({Timer1: Value(varPreviousTime) * 1000 * 60});

     

    Replace Timer1 with the name of your timer control and adjust the conversion factors if you want to store the time in seconds or hours instead of minutes. This is a simplified example and assumes you are storing the time in minutes as text. You will need to ensure the formats match when converting back and forth between the timer value and the stored text.

    This approach allows you to keep accumulating time by retrieving the stored value and setting the timer's starting point to that value instead of zero. Remember to handle scenarios where the timer value may not be present or is in an unexpected format to prevent errors in your app.


    Best Regards,

    Hassan Raza

  • cardinalnight Profile Picture
    212 on at

    Do you have to set the Default of the Timer control to be a variable using (UpdateContext)?

    Update: Just found out there is no Default for the timer. I'm intending the user clicks the timer control to start and stop it, instead of using a dedicated start btn and stop btn. Would I replace the OnTimerStart and OnTimerEnd properties with the updateContext? 
    Update: @Hassan_SZ_365 this doesn't work btw. When dividing by 1000 / 60 only shows 0 when submitting to SharePoint.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard