I feel like this has been asked multiple times, but I looked through all the posts and just can't seem to get it right. (might totally be because of limited experience.)
I have an initial form that is used when new. (I have set the sharepoint integration to OnNew), this same form then has a submit button that then takes you to a new screen and form, which has a submit button that takes you to a new screen and form.
I then created a view form (which is also used for edit), with all the information that has been captured. The problem is it only displays the information from the first screen.
So I eventually figured out I should use patch, but all the patch codes I've found doesn't really make sense, and its not working.
So on my second screen submit button I now have this
SubmitForm([@EditForm1_1]); Set (OverallCriticality,DataCardValue112.Text); Patch('name of list',EditForm1_1.LastSubmit); Navigate(SecurityNew, ScreenTransition.Fade)
(I have set the overall criticality as I use it in the next screen and that works fine.) (I haven't done the 3rd screen yet as I thought it would be exactly the same. )
Does this code look right? Am I suppose to patch every single record? (I did try that but it kept giving me an error so used the above code which didn't give me an error but also didn't do the job.
PS: OnSuccess is set to Set(myLastRecord,EditForm1_1.LastSubmit) and the item is set to If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First([@'Name of list']),SharePointIntegration.Selected)
Would really appreciate you helping me over this last hurdle!!!!
A collection won't really solve anything. You would still have to use a Patch() to get it into the collection. @v-yutliu-msft solution should also work.
@Pstork1I think that is waaaayyy above my ability. Lets hope I can achieve the same thing with @v-yutliu-msft option.
What about collection could that work?
Choice fields are complex data types and need to be patched using a specific format. Take a look at the following article that will walk you through what the format needs to look like:
http://powerappspros.com/2017/05/powerapps-pro-tips-patching-sharepoint-lists/
Thank you both.
@v-yutliu-msftI tried what you suggested but it now gives me one of those weird errors right at the end. (Requested operation is invalid. Server response: Invalid URL:mmm.Client requestid and tehn a whole bunch of numbers) and then nothing is saved.
I followed your directions - navigate on first two screens and the last save button used this:
Patch('List Name',Defaults('List Name'),SharePointForm1.Updates,EditForm1_1.Updates,EditForm2_1.Updates); Navigate([@'Thank You mesage'],ScreenTransition.Fade)
@Pstork1Most of the fields I want to patch is choice fields so I'm using datacardvalue.selected.value. But it doesn't want to accept that. It keeps giving an error (the red cross that says something is wrong with your formula)
Double check all the field names and the list name to make sure they are correct. Also, you can't just use the data cards for the value. you have to use the property of the data card that holds the value. So for example, if you have a textbox data card then the value is actually Datacardname.Text. The property you use will differ depending on the type of value stored.
Hi @Anonymous ,
Do you want to use multiple forms to create a new record?
The previous form's button only be used to navigate. You just need to submit the form in the last form screen.
I assume that you have three screens.
Please set button in screen1's OnVisible:
Navigate(screen2)
Please set button in screen2's OnVisible:
Navigate(screen3)
Then submit the form in screen3.
You could set the submit button's OnSelect in screen3 like this:
Patch('List Name',Defaults('List Name'),Form1.Updates,Form2.Updates,Form3.Updates)
//then you will use data in form1,form2,form3 to create a new record. This solution is more simple. You need to enter all the form name in the formula, no need to enter all the field names in the formula.
Or using the solution like @Pstork1 posted, which is a little complex.
In this solution, you need to enter all the field names and pay attention to the field data type.
In screen1 and screen2 is the same as what I mentioned above, set the last form's submit button's OnSelect:
Patch('List Name',Defaults('List Name'),{'Impact Assessment Outcome':DataCardValue106.Text,'Likelihood Outcome':DataCardValue111.Text,'Overall Criticality':DataCardValue112.Text,.....})
(I assume that all the datacardvalue is textinput controls and the fields are all data type.)
To sum up:
If you use "Formname.Updates" in patch function, you need to configurate every datacards' Update based on field data type.
If you use "fielname:controlvalue" in patch function, you need to use different formulas based on field data type.
If you still have problems, please tell me which solution that you want and the fields' data type.
Best regards,
@Pstork1- thank you so much for all your help so far.
It doesn't seem to work for me, please can you see if I've done something wrong
Patch('List Name',Defaults('List Name'),{'Impact Assessment Outcome':DataCardValue106,'Likelihood Outcome':DataCardValue111,'Overall Criticality':DataCardValue112}); Navigate(SecurityNew, ScreenTransition.Fade)
Field1, field2 would be the column names from the list. The values would reference the data card values that you are adding to the list record. Hope that clarifies.
I'm really sorry but please can you explain what you mean here...
{field1: value from some form, field2:value from some form, etc})
Do I use the datacardvalue or the actual field name as it is on the list?
Yes, that's the difficult part. When you SubmitForm() the form defines the fields that are being submitted. But when you do a Patch() with multiple forms you'll need to specify every field that you want to populate and the value from the form that will be used. So it is much more complex. That's why people use SubmitForm(). But Patch() also allows a lot more flexibility, which is what you need if you want multiple forms.
WarrenBelz
85
Most Valuable Professional
MS.Ragavendar
54
Michael E. Gernaey
42
Super User 2025 Season 1