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 / Dynamic timers stop wh...
Power Apps
Answered

Dynamic timers stop when I leave/hide website. How can I get them to continue working?

(0) ShareShare
ReportReport
Posted on by 54

Hi,

I have an app that helps me time the different tasks I do every day. It is dynamic and when I turn on a timer, all other timers are turned off, so only one timer is active. Except for the timer at the top which starts as soon as I open the App, this one sends a backup email after x minutes with the current time spent.

The problem I have is that the dynamic timers stops/pauses after a few minutes when I do something else, ie leave/hide the Timer window. But the timer at the top still keeps going. I have added the code for both types of timers (I got some great help from this Community on the dynamic timer), and I hope someone might know how to fix it so that the dynamic timers also keeps going, even if I leave/hide the window.

 

Anna_H_0-1678376681386.png

Dynamic timer:

AutoPause

false

AutoStart

false

Duration

1000

Fill

If(timerRunning=ThisItem.LineNbr,RGBA(152,208,70,1),RGBA(128, 128, 128, 1))

OnSelect

Set(timerRunning, ThisItem.LineNbr)

OnTimerEnd

Switch(

    CountRows(Filter(timeTrack, rowID=ThisItem.LineNbr)),

      0, Collect(timeTrack, {rowID: ThisItem.LineNbr, TimeElapsed: 1000}),

      UpdateIf(timeTrack, rowID=ThisItem.LineNbr, {TimeElapsed: TimeElapsed+1000}))

Repeat

true

Start

timerRunning=ThisItem.LineNbr

Text

Text(Time(0, 0, LookUp(timeTrack, rowID=ThisItem.LineNbr,TimeElapsed)/1000), "hh:mm:ss")

 

Timer at the top:

AutoPause

false

AutoStart

true

Duration

If(CheckboxBackUp.Value = true && Value(i_backupMinutes.Text)>0,i_backupMinutes*60000,360000) //360000 needed or an email will be sent every second

OnTimerEnd

If(CheckboxBackUp.Value = true, SendBackUpEmail.Run(HtmlText1.HtmlText))

 

Kind regards,

Anna

Categories:
I have the same question (0)
  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    Hi @Anna_H 

     

    I believe it is not possible for the timer to keep running if the app is exited (https://powerusers.microsoft.com/t5/Building-Power-Apps/its-possible-if-I-closed-the-app-after-checked-in-than-the-timer/m-p/1266516#M332341)

     

    As mentioned in the above thread, an option would be to save the actual time (i.e. 03/09/23 5:54pm) to a data source, such as SharePoint, and then factor that in when the app is reopened.

     

    Or, capture the start time and use a timer to update the current time, then use that to determine the duration of your task.

    Set(Current Time, Now())

     

  • Anna_H Profile Picture
    54 on at

    Hi @Rusk , the app is not exited it is still running. It is just not in focus as I might leave for another web-site in another tab. And the top timer runs perfectly. It is just the other timers with the code that stop working.

  • Verified answer
    Anna_H Profile Picture
    54 on at

    Just an update, I rebuilt my app, and it is now working. I think it was the switch code in OnTimerEnd that made the timer stop when leaving/hiding the page. I removed this and made a lot of other changes and it is now working fine.

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 602

#2
WarrenBelz Profile Picture

WarrenBelz 473 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 310

Last 30 days Overall leaderboard