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 / Populate NewForm with ...
Power Apps
Unanswered

Populate NewForm with last submission

(0) ShareShare
ReportReport
Posted on by 6

Hi, 

Wondering if this is possible...Relatively new to PowerApps, but I've looked and having trouble finding an answer.

 

I'm using a somewhat basic View/Edit/NewForm, although it does have date picker and a few dropdowns. The user just told me they often submit batches of entries that are mostly the same, so they'd like to have a button to pre-fill a NewForm with the last submission and just make minor changes before submitting.

 

I've tried using LastSubmit, but that gets wiped out any time you switch to NewForm mode. Considered passing all values to variables, but there are quite a few, so wondering if there's a cleaner way to solve. 

 

Thanks!

Categories:
I have the same question (0)
  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    1. Create a View Form

    2. Add a datasource to that form with the below filters

    Last(Sort(Datasource_Name,createdon,Ascending))

    Hope this helps!

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    @Slamrc 

    One way to do this is to add an edit form to a screen. Set the DataSource property to your data source and the Item property to the following:

    Coalesce(varLastSubmit, Defaults(YourDataSource))

    For your save button, add the following formula (rather than calling SubmitForm)

    Set(varLastSubmit,
     Patch(Product, Defaults(YourDataSource),EditForm1.Updates)
    )

     

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Slamrc 

    Yes, this is quite basic to do.  The trick is to hold on to the Last Submitted record from your form.

    To do that, make sure you have a formula such as this in your OnSuccess action of your form:

        Set(glbRecord, Self.LastSubmit)

     

    Now, for your Item property of your form, you would simply patch in the values from the last submit that you would like.  

    For example, if you have a Title and an EntryDate column in your record that you want to persist to another entry, then you would do the following in your Item property of your Edit Form.

    Patch(Defaults(yourDataSource), {Title: glbRecord.Title, EntryDate: glbRecord.EntryDate})

     

    NOTE: Keep your for in Edit mode all the time.  Ignore using New form as the above formula will always be providing a New record.

     

    One additional note, if you want the entire record last submitted to be used again, then change your Item property formula to:

    Patch(glbRecordm {ID: Blank()})

     

    I hope this is helpful for you.

     

  • Slamrc Profile Picture
    6 on at

    Thanks @RandyHayes, that might work but just wondering...

     

    You mentioned to keep it in Edit mode as the above solution will always submit a new record. What I'm trying to accomplish is for the form to be able to:

     

    1) View

    2) Edit existing records

    3) Submit new record (starting from blank form)

    4) Submit new record (copied from previous if user selects that option).

     

    If the form is always submitting a new record, seems like I wouldn't be able to edit existing? Probably need to change button function conditionally based on user selection, along with conditionally changing the Item between blank and "copy from previous".

     

    Appreciate the help, think this definitely gets me closer, I'll test it today.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Slamrc 

    It is all a matter of providing the ID!!  This is true for Forms and for the Patch function as well.

     

    If you provide the primary key (ID in this case) then the Form will submit and update the existing record (essentially what you call "Edit Mode").  If you provide a Blank ID, then the form will create a new record (what you call "New Mode")

    View mode is something completely different...the only thing that does is put the DisplayMode into View!

     

    So, with the form in Edit mode - If you provide this for the Item property (either directly or through a variable):

        Defaults(yourDataSource)

    Then even though the form is in "Edit Mode", it is still going to create a new record.

     

    If you provide this for the Item property:

       Patch(Defaults(yourDataSource), {Title: "Something"})

    Then it will also create a new record when submitted.  The advantage on this is that the Title column is already filled out.

     

    If you provide any other record with a valid ID, then you will just be editing the record as usual.

     

    Does that answer your concern?

     

     

  • Slamrc Profile Picture
    6 on at

    That helps a lot, thanks @RandyHayes!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard