cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ngreen
Resolver I
Resolver I

Submit Multiple Forms into One SharePoint List Entry

I'm working on a new mobile phone PowerApp that takes one large sharepoint list and divides the questions across multiple screens. This has resulted in multiple Edit Forms that I am looking to have all of them submit back to just one combined entry in the SharePoint list. Typically, when I do this, I just have the first Edit Form  have hidden datacards that match the datacardvalues of the other Edit Forms. Due to the large number of questions/columns, I was wondering if this is the best way to do this, or if there is an easier way?

1 ACCEPTED SOLUTION

Accepted Solutions

Hey @ngreen 

 

A better way to do this would be to use the Updates attributes of the form control on the final page as:
 
Patch(DataSourceName, Defaults(DataSourceName),Form1.Updates, Form2.Updates,Form3.Updates)
 
Hope this helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

14 REPLIES 14

Hey @ngreen 

 

A better way to do this would be to use the Updates attributes of the form control on the final page as:
 
Patch(DataSourceName, Defaults(DataSourceName),Form1.Updates, Form2.Updates,Form3.Updates)
 
Hope this helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
mdevaney
Super User
Super User

@ngreen 

You could PATCH the records as the user advances through each screen instead of using the SUBMIT function. 

 

My assumption is you will be distributing this survey to members of your organization through email.  When the user starts the survey you'll want to capture their email address.  This unique identifier will be used to create the blank survey record.  Put this code in the OnSelect property of your survey's start button.

 

Patch(
	your_datasource_name,
	Defaults(your_datasource_name),
	{email:User().Email}
);

 

Then create your first screen containing survey questions.  When you are done, put this code in the OnSelect property of the next screen button.  Of course, you'll have to change the question numbers to match the column names you want to update.

 

Patch(
	your_datasource_name,
	LookUp(your_datasource_name,email=User().Email),
	{question1:true,question2,false,question3:true}
)

 

Repeat this method on as many screens as you require.

 

You might be wondering why I am suggesting to create a new record right when the survey is started rather than wait until the end of the process.  This is because I prefer to save the user's progress on each page.  When a user is filling out a long form they may want to take a break or they may get interrupted so its a nice feature to have Smiley Very Happy

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

@yashag2255 

 

This worked! Thank you! 

Hi @yashag2255 , 

 

This helped me as well. KUDOS!!! Thank you very much!!!! 🙂

Afternoon

From what I am reading this should work,

 

Patch('SP List',Defaults('SP List'),form1.Updates,form2.Updates,form3.Updates, .... ,form 12.Updates)

 

but I am getting "the function patch has some invalid arguments" for some reason.

 

A little help would be appreciated.

 

I have a lot of columns on my SharePoint list.

 

IT_Guy
Frequent Visitor

Yeah, found my error, I left out the last updates in my code.

@mdevaney Hi, thanks for sharing your code - this looks like something that would work in ours. We have 1 sharepoint list (NEApp) and a few different forms across screens. The idea is that they will complete each form every week throughout a 6-week training course so it would be great to only patch over each individual form to the same user's record in SPlist. 

 

So we've added your Patch code including the email, but for some reason, it is only patching blank rows to our SharePoint, the only column that has information patched over is the Email - every individual form is just empty. I have tried recreating the list, I've readded new data cards but it's still just patching blank rows. We don't have a start button but added the start code to the previous screen's next button. All the columns are single/multiple lines of text or numbers (star rating 0-5). Any ideas please?

Try @yashag2255's solution that I marked as the accepted solution. It worked for me and resolved my issue. Here's the code they provided:

 

Patch(DataSourceName, Defaults(DataSourceName),Form1.Updates, Form2.Updates,Form3.Updates)

 

I'll try to look up where I used this in my one powerapp to try and give more reference, if needed.

 

EDIT: I found where it is. As mentioned above, I have multiple Edit Forms that come from one giant SharePoint list and needed all of the Forms to be combined into one data entry. Code ended up looking like this:

 

UpdateContext({load:true}); Patch('SHAREPOINT LIST NAME', Defaults('SHAREPOINT LIST NAME'), Form1.Updates, Form2.Updates, Form3.Updates, Form4.Updates, Form5.Updates, Form6.Updates, Form7.Updates, Form8.Updates); Navigate(Confirm,None);

 

 

Not sure if this will fully work in your case since my data is all submitted at one time, and your's is across a few weeks, but it might be able to help you towards a solution.

Hi @ngreen thanks for replying! Did try that but doesn’t seem to send anything over to the list. The problem we face as well is that it’s an informational user guide app with an about you, weekly check ins and then feedback form. There isn’t necessarily a clear start to finish process and we don’t want to wait until 6 weeks in to get any data through at the very final stage of the app. 
Due that I can’t really work out what needs to go where apart from sending through parts of the data at each form stage. Ideally to the same row but to be honest at this rate any data pushed through is better and we can figure it out later in excel! 
I’m tearing my hair out because it must be an easy fix. 

previously we’ve only used online/offline collect save data load data etc to complete forms on other people. But we don’t need them to work offline and we want the user to complete the app on themselves, and to save their entries as they go through training to refer back. 

thanks 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,337)