cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Clint123
Frequent Visitor

Saving data to two SharePoint Lists

Hello all,

 

I am not sure if this has been resolved prior to this but I haven't discovered the solution.

 

So I need to have two lists in one form on Powerapps.

 

Filling out the data is no issue but when I submit the form, it only saves the data to one list and not the other.

 

Is there a way to save the to both lists? 

 

Note: I attempted to use the 'Patch' Function but had no success connecting to the other list.

 

Any help would be great, thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

@Clint123 

 

Please use two patch functions on the button click 003.png

 

 

Patch(MyList1,Defaults(MyList1),{Title:TextInput1.Text,Column1:TextInput1_1.Text});Patch(MyList2,Defaults(MyList2),{Title:TextInput1.Text,Column1:TextInput1_1.Text,DateColumn:DatePicker1.SelectedDate});

 

This is will execute both the function synchronously (One After another) 

 

If you would like to Asynchronously - you could concurrent function https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-concurrent  

 

Concurrent(Patch(MyList1,Defaults(MyList1),{Title:TextInput1.Text,Column1:TextInput1_1.Text}),Patch(MyList2,Defaults(MyList2),{Title:TextInput1.Text,Column1:TextInput1_1.Text,DateColumn:DatePicker1.SelectedDate}))

 

This will save data async and the perf will be better. 

 

Output : 

001.png002.png

View solution in original post

6 REPLIES 6
svijay_001
Microsoft
Microsoft

@Clint123 
There should be two patch function to update items in each list.

Can you please let me know/share the patch function with me ? 

SilvesterP
Frequent Visitor

Hey!

 

What does your patch function look like for each one?

 

For "complicated" patches I would build a flow:

  • Create a flow with PowerApp Button as the trigger
  • Build a parallel branch to check if the item already exists in the respective lists
  • Update or create the item accordingly.

 

Cheers,

P

 

Here is the Function I have:

 

Patch('My Data Source',Defaults('My Data Source'), {Description1: TextInput2.text, Assigned1: ComboBox1.Selected.DisplayName, DueDate1: DatePicker1.SelectedDate, status1: Radio1.Selected.Value})

 

Thank you.

@Clint123 

 

Please use two patch functions on the button click 003.png

 

 

Patch(MyList1,Defaults(MyList1),{Title:TextInput1.Text,Column1:TextInput1_1.Text});Patch(MyList2,Defaults(MyList2),{Title:TextInput1.Text,Column1:TextInput1_1.Text,DateColumn:DatePicker1.SelectedDate});

 

This is will execute both the function synchronously (One After another) 

 

If you would like to Asynchronously - you could concurrent function https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-concurrent  

 

Concurrent(Patch(MyList1,Defaults(MyList1),{Title:TextInput1.Text,Column1:TextInput1_1.Text}),Patch(MyList2,Defaults(MyList2),{Title:TextInput1.Text,Column1:TextInput1_1.Text,DateColumn:DatePicker1.SelectedDate}))

 

This will save data async and the perf will be better. 

 

Output : 

001.png002.png

View solution in original post

Thank you for that breakdown. I found the first part of my issue with the column names having to match the URL field name not what is on the SharePoint list

 

It picked up my function which is great.

 

BUT

 

This is where my second issue comes in. Text inputs and date pickers are fine, but I can't seem to have it pick up other controls. Please see the pictures below.

 

The Patch function now works.The Patch function now works.

 

Patch function can't find Radio1 control but you can see it there on the left tree.Patch function can't find Radio1 control but you can see it there on the left tree.When I specify the data to patch the whole function has a red underline.When I specify the data to patch the whole function has a red underline.

 

Any help would be sensational! Thank you.

What's the error when you mouseover the error?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,019)