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 / Autosave with timer co...
Power Apps
Answered

Autosave with timer control with loop enabled

(0) ShareShare
ReportReport
Posted on by 294

Hello,

 

I have screen1, screen2. I have a timer control on screen2 set to 60 seconds with repeat turned on. Ontimer end is set to Patch('datasource', Defaults('datsource'), EditForm1.Updates, EditForm2.Updates) and I also have a submit button on screen2 which kicks of a flow and also submits the item to sharepoint using the same patch function. Since trepeat is turned on, I see multiple entries created in sharepoint list and also final submit creates on more entry. 

 

Is it possible to save everything in one sharepoint list item without multiple entries?

 

Thanks,

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    When you have `Defaults(datasourcename)` as the second parameter of the Patch function, it will always create a new record - which is why you're seeing many new records in your list.

     

    If you want to have only one record auto-submitted (via the timer), you can store the current record to be stored in a variable, whose initial value would be `Defaults(datasourcename)` - so that the first time it will create a new record. But afterwards, you need to have that record that was created, so you'll be updating that record instead of creating a new one.

     

    For example, in the OnVisible property of the first screen you can have the following expression:

    Set(currentRecord, Defaults(datasourcename))

    In the timer end, you can patch the current record - and update the current record with the result of Patch.

    Set(
     currentRecord,
     Patch(
     datasourcename,
     currentRecord,
     EditForm1.Updates,
     EditForm2.Updates))

     

  • ck25415 Profile Picture
    294 on at

    Hello @CarlosFigueira,

     

    Thank you, that worked but whenever the timer ends after submitting the data to the sharepoint list its also clearing the existing text in the powerapps. Is there way to continue from the last word entered in the text field.

  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    Not if you're using forms; when you use a form, and a data source is updated (i.e., in a Patch operation), then the form will take the result of the operation and make any updates that the server has - and will reset its fields to take those values.

     

    You may be able to go avoid using forms (for an example, see this blog post by @Meneghino), but you will need to handle the updates yourself. You can also have several "checkpoints" where the user will initiate a save (Patch) operation, instead on relying on a timer to do that on the user's behalf.

  • ck25415 Profile Picture
    294 on at
    Hello Carlos,

    By setting the item property of the form to empty(i.e nothing in the field) I was able to see the previous saved text and was able to make further changes to text and update the item in SharePoint. Do you think that the method suggested by you in the blog is better way to deal this problem, please suggest.
  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    I haven't tried setting the Item in the form to empty, so if it works for you, then great. The blog post gives you more control over the layout / data, with the drawback that you need to handle the changes yourself.

     

    Remember, however, that many times you do want to get the updated item from the server after a Patch operation (when someone else edited the item, if there are any server-generated columns, etc), so ignoring the result from the server (which you will do if you set the item to blank) may lead to hard-to-find problems.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard