I’ve been looking at Forms, SharePoint, and Flow to potentially provide a solution to a need we have: I need to have multiple forms populate various fields in a SharePoint List record. Is something like this possible? Here’s the scenario: Let’s say I have a SharePoint list with 12 fields. I would like to have the submission of Form #1 trigger the creation of a SharePoint list record. THis first form would have say, 5 fields leaving 7 unpopulated fields in the record. That much is very easy with Flow. I would then I would like a notification to go to another person and present that person with Form #2 which would prompt for 4 fields and populate those in the SharePoint record created from Form #1. This leaves 2 fields left. Then I would like a third person to receive a notice to fill out Form #3 which would populate the remaining 2 fields in original SharePoint List record. Ideally, notifications for Form #2 and Form #3 would go out concurrently, and completed as the user is available. Then, when all three forms are successfully submitted, a final notification goes back to the first user to approve the record. I know this is rather complex, and likely outside the scope of Flow and Forms, but I thought I might give it a shot. Suggestions? (Visited 462 times, 1 visits today)
In Power Apps it is possible to have multiple SharePoint list forms on one list’s custom form. The SharePoint setupI created two SharePoint lists. With a lot of imagination I called them list 1 and list 2. When I create a new item in list 1 I want to create an new item in both lists. When I edit an item in list 1 I want to edit the items in both lists. If you want to use this pattern in a normal canvas app that isn’t a custom form then just add the forms as described in the Microsoft documentation about forms in Power Apps. Multiple SharePoint list formUsing the Power apps menu option on list 1, I created a custom form with Power Apps that looks like this. Multiple SharePoint list formThe Orange form is the one that writes to list 1 and the green form writes to list 2. The first form is added by Power apps, the second one I had to add to the same screen. With a bit of resizing of the app it isn’t too difficult to do. Now when I set the title of both forms to item 1 and hit the save button … Only the item in the first form is saved to list 1. List 2 is not updated. So even though I have Multiple SharePoint list form only one of them is really used. My second form is also not reset back to empty values. We will need to do some work here to make it all work as expected. Multiple SharePoint list forms may not be that easy. Updating multiple datasourcesFirst of all you could consider other data update methods as I described in Patch, SubmitForm and Update. However this time I will just use the Submitform and other form operations. First of all we need to have a look at a number of pieces of code in the form that will need to be updated. The code that we need to consider is:
OnSaveThe OnSave is by default set to: SubmitForm(SharePointForm1)To make sure that the item is saved to the second item I will need to update the onSave to support my additional form. This second form is called Form1 SubmitForm(SharePointForm1); SubmitForm(Form1)With this OnSave code the out of the box save button. OnEditThe OnEdit is set to EditForm(SharePointForm1)You might think that the following code would work, but … EditForm(SharePointForm1); EditForm(Form1)… you will find only one item is being edited. So I added the the Item for my green form First(Filter(List2, Title = DataCardValue1.Text))And now when I edit an item I get both items to appear. Ok, this example isn’t very exciting and quite often you might have to use different fields to link the items in the separate lists. Just make sure that you have a key field that you can match up in both lists. Also as the lists may contain more items , you might need to consider setting your indexes on the list columns correctly as multiple SharePoint list forms will hit both lists. But hey, we now have something that look like a relational Power app form! OnCancelThe OnCancel is set to ResetForm(SharePointForm1)This will need to be updated to ResetForm(SharePointForm1); ResetForm(Form1)OnNewThe OnEdit is set to NewForm(SharePointForm1)This will need to be updated to NewForm(SharePointForm1); NewForm(Form1)OnViewThe OnView is set to ViewForm(SharePointForm1)This will need to be updated to ViewForm(SharePointForm1); ViewForm(Form1)Further ThoughtsWhen merging two lists into one I might consider most of the time to create a screen with many controls on it and then use the patch function instead of the forms. However as a quick solution I could consider the multiple SharePoint list form approach as described in this post. It doesn’t suit all use cases but definitely some. |