cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OndrejBriza
Advocate I
Advocate I

Canvas App - pre populate new form

Hello

Im building Canvas App kind a like a wizard to make thing easy for basic users. 
I need to create a sequence where I take variables from gallery shift into next screen that works fine than I edit those records in Edit Form also fine but then I need to shift to another screen with New Form and somehow pre populate fields in New form with the records I editted in Edit form. Is there a way to do that ? (I thought about collection but there is a mix of datatypes in those record lookups, choice, multiple choices almost everything)

 

Thanks I will be glad for any advice 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@OndrejBriza 

You can do this easily by getting the last submitted record in the OnSuccess action of your form.

Skip the concept of "NewForm" and stay away from it as you don't need it in this case.

Instead, in your OnSuccess action of the form, set a variable as such :

   Set(glbNewCopy, Patch(Self.LastSubmit, {ID: Blank()})

This will create a variable with the exact copy of the submitted record and will blank out the Primary Key (ID)...which means to PowerApps, it will be a new record when used.

 

Then set your Item property of your form to : glbNewCopy

If you want to reuse the same form (recommended), the set the Item property to:

    Coalesce(glbNewCopy, Defaults(yourDatasource))

This will give you a blank record if none has been submitted so far.

 

If you are loading the record from a gallery instead, then change the above to:

    Coalesce(glbNewCopy, yourGallery.Selected)

 

Keep your form in Edit mode always.  There is no need for NewForm and it should not be called either.  It's ALL about the primary key column - in this case the ID.  If ID is blank, then the form KNOWS that it is new.  If ID has a value, then the form KNOWS it is Edit.  It's just that easy.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

11 REPLIES 11
Gelos
Super User
Super User

You want to show edited value in next scree. am I correct or not.

Yes values that were displayed or edited in Edit Form should be filled or pre populated in the next screen on New Form so user dont have to fill them again and can create copy of that record. 

 

One way is store value in set variable. And navigate next screen the put the respective variable name with respective text field.

If this answer helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

I know how to use set but problem is that I use Set(MyVariable, ThisItem) on the gallery in first step. 
Second step is to display data in edit form that I can still do by using data in MyVariable but I dont know how to store the new data from the saved edit form and fill data in next sceen into New Form so user can sequentially do Choose data from gallery -> Edit Data in Edit Form -> Create copy with pre filled fields from edit Form  in New Form in last screen. 

I didn't understand. User edited the data and click save button. When click save button data will be saved then navigate next screen. In the next screen you should show the new data. am I correct or not

Yes but the new data have to be filled in Form with attribute Create new record or as its wierdly called NewForm and I dont know how to collect them and fill into the next one.   

You not need create new form. You can create display form.

Go to insert -> form-> Display

Then 

Select data source  which table's data can be displayed.

Definitely you have unique value So you store the value in set variable. like Set(unique value, Text input box. Text )

Text input box which contain unique value.

Then go to Item property of display form. User filter function.

Last(Filter(table name ,Unique column name from table=unique value)) 

 

If this answer helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Unfortunatly I do have to use New Form because after submiting the New form it will create a copy with that edited data. Users task is selecting record editing the Form by changing date and than creating a exact copy and selecting new date as a process of ending one record and starting new but with different date and keeping the old copy still in the system. 
Will your solution work also with New Form or just with display Form ? 

No. But You can user look up function.

You use set variable to store unique value after navigate in the new form. You can try  lookup function 

go to input box default property.

Lookup(table name, unique column name=unique value, column name which data you want)

 

If this answer helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,845)