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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Timer Control for Gall...
Power Apps
Unanswered

Timer Control for Gallery Items

(1) ShareShare
ReportReport
Posted on by

Hello

 

Hoping someone can give me some advice on how to tackle this problem as I'm new to powerapps and stumped! I'm trying to create a situation where users complete forms from a gallery selection and once they have complete the form have a set amount of time to go back and edit the form from the gallery before it is hidden from view.

 

My gallery is run off a SP list and to start with I created a field for 'TimerEnd' as a choice column with Yes/No (avoided using y/n field as I understand there are some issues with updating context). The plan was to filter the gallery on the TimerEnd yes/no values by doing the following:

 

I created a timer on the item screen where the form is and then made the submit button on the item edit form start the timer using 'UpdateContext({Timego:true})' and setting the timer start to 'Timego'. For the OnTimerEnd I used:

 

'Patch('SP list name', First(Filter('SP list name', ID= 'gallery name'.Selected.ID)),{TimerEnd:{'@odata.type':"#Microsoft.Azure.Connectors.Sharepoint.SPListExpandedReference",Id:1,Value:"Yes").

 

to hopefully patch the SP list value once the timer ends. The form on submit is set to email a user using O365 Send email and then Refresh and Navigate back to the home screen.

 

This all seems to work fine, pressing submit starts the timer, the timer ends and as long as I don't navigate away from the form screen the TimeEnd form value changes from No to Yes when the timer ends, however I don't want the user to have to sit and look at the form and want to navigate them back to the home screen while the timer ticks down. I have checked that the timer AutoPause is set to false but for some reason the patch is not updating the SP list value.

 

Can anyone point out where I have made the mistake or suggest another/better way to filter the gallery to hide items after an amount of time? (I can't use default modified date as admin users set the form up for users)

 

Thanks in advance for any help anyone can offer!

 

 

 

 

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Update: I have just adjusted the patch to use 'Formname'.LastSubmit.ID instead of gallery.selected and this seems to have done the trick so I imagine the issue is once navigating back to the home screen essentially no gallery item is selected when the timer runs out(?).

     

    I would still welcome any thoughts on how to improve this process as the above will not be suitable as the duration for the timer is meant to be 60 mins and I cannot rely on more than one form not being submitted during that time so LastSubmit is not appropriate.

  • Community Power Platform Member Profile Picture
    on at

    A slightly different approach I've used is to set a timer to autostart, OnTimerEnd > Patch something, set autorestart to true. 

     

    My use case is tracking time for work instructions in the event the user forgets to use my operation start/stop buttons. Worse case is I'll have the time within 5 minutes. 

     

    So for your case, you could use a ForAll / patch setup in your ontimerend. Such that say every 3 minutes it would patch all that hadn't been patched yet. 3 min is arbitrary, you can set your duration to whatever you want. 

     

    Just an idea, hope it helps.

  • Community Power Platform Member Profile Picture
    on at

    Thank you @Anonymous , unfortunately I managed to get it to work as above but then realised it was pointless as when the app is closed the timer stops. Instead I'm trying to now fitler the gallery using a Datediff(submittime,now(),Minutes) formula using a date/time field in the SP list but it's showing the same time for all gallery items. I have tried thisitem.submttime with the same result too. Not really sure what avenue to try next

  • markperrah Profile Picture
    47 on at
    What if you set a variable as a time stamp on submit with the username as part of the variable.
    then the gallery can filter items based on a lookup of the timestamp and username and only show matches within the time range you want to allow:
    Or patch the datasource with date and time and userID, something like this:
    Patch(DataSource, Defaults(DataSource),
            {Title: glbUser,
              ActivityDateTime: Text(Now(), "yyyymmddhhmm"), 
              ActivityDate: Now()
            }

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard