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!
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?
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.
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.
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)
)
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!
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1