cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TKrause5
Level: Powered On

Submit a Collection to a SharePoint List

I am creating an app for my company that allows sales employees to request inventory using a mobile device. 

 

The app is similar to a checkout shopping cart fuction BUT no money transaction is needed. 

 

The app pulls invetory from a sharepoint list and allows the user to add items to a 'Shopping Cart' using a collection to store/display the data in a gallery. 

 

Needs: I need to submit the collection to a SharePoint list. The collection could have multiple rows.

 

Question: Is this possible to submit a collection with mutliple rows into a sharepoint list??

 

if so how?? 

 


Accepted Solutions
MelindaK
Level 8

Re: Submit a Collection to a SharePoint List

Hi @TKrause5

 

It is possible to submit collections to SharePoint with multiple rows at a time by using a combination of ForAll and Patch to submit the items.

 

For example, your OnSelect property of a Submit button would look something like this:

 

ForAll(CollectionName, Patch(SharePoint_ListName, Defaults(SharePoint_ListName), { ColumnName1: value1, ColumnName2: value2, etc})

- where value1, value2 are columns in your collection

 

Here's more documentation about the functions:

https://powerapps.microsoft.com/en-us/tutorials/function-patch/

https://powerapps.microsoft.com/en-us/tutorials/function-forall/

 

Let me know if you need more guidance Smiley Happy 

MelindaK

All Replies
MelindaK
Level 8

Re: Submit a Collection to a SharePoint List

Hi @TKrause5

 

It is possible to submit collections to SharePoint with multiple rows at a time by using a combination of ForAll and Patch to submit the items.

 

For example, your OnSelect property of a Submit button would look something like this:

 

ForAll(CollectionName, Patch(SharePoint_ListName, Defaults(SharePoint_ListName), { ColumnName1: value1, ColumnName2: value2, etc})

- where value1, value2 are columns in your collection

 

Here's more documentation about the functions:

https://powerapps.microsoft.com/en-us/tutorials/function-patch/

https://powerapps.microsoft.com/en-us/tutorials/function-forall/

 

Let me know if you need more guidance Smiley Happy 

MelindaK
TKrause5
Level: Powered On

Re: Submit a Collection to a SharePoint List

Thanks!

 

Worked like a charm... 

 

Just to note: 

ForAll(CollectionName, Patch(SharePoint_ListName, Defaults(SharePoint_ListName), { ColumnName1: value1, ColumnName2: value2, etc})

 ColumnName1 - is the name of the sharepoint column

 

Value1 - is the collection column

anuarn
Level: Powered On

Re: Submit a Collection to a SharePoint List

Hi,

 

Good information. Any thoughts on this scenario?

 

  1. I've created a Sharepoint List to record customer site audits.
  2. In one single visit, the technician could log information for different assets where each has more than one component to assess.
  3. So it would be great to have just one form for every visit, so inside this PowerApp form, they'd be able to log the customer name, site location, but also, the audit items for each asset at once.
  4. If this isn't possible, they have to open a form every time and type customer basic information to log each one of the assets.

 

Is there a way to accomplish this?

 

To make it easy, here are two sample images:

 

 

This is the Form I expect to build:

PowerApps-MultipleRecords02.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

This is the records I expect to have:

PowerApps-MultipleRecords.PNG

 

 

 

 

 

 

 

Thanks in advance!

MelindaK
Level 8

Re: Submit a Collection to a SharePoint List

@anuarn this is something very easy to achieve in powerapps by creating your custom form, not using one by default.

 

For example, you would have your customer information separated from your assets, so they only get filled in once and their values are stored in variables, i.e. on a text box on the OnChange property collect the value in a variable:

 Set(vClient, textbox1.Text)

 

Then on the assets part of the app you would have your text boxes/drop downs and a button. On the button press you would collect the information given and will clear the controls to allow a new asset information to be entered. I.e. on button OnSelect property you would have:

 

Collect(cAudits, {Customer: vClient, Date: vDate, Asset: textbox2.Text, Component1: textbox3.Text});
UpdateContext({resetVal: false});
UpdateContext({resetVal: true})

Then you would use the resetVal variable on the textbox Reset property (hint: the value needs to be changed from false to true in order to take effect).

 

 

Then you would give them a button to submit all the information and on that button you will Patch your Collection to the SharePoint list.

 

Hope this makes sense Smiley Happy

MelindaK
anuarn
Level: Powered On

Re: Submit a Collection to a SharePoint List

Thanks a lot @MelindaK!

 

This was very helpful for me to move forward.

Winston
Level: Powered On

Re: Submit a Collection to a SharePoint List

Hi,

Do you also need to enable the Sharepoint List somehow?

I have added the data source, but PowerApps doesn´t recognize the column names.

"The specified column 'XXXXXXX' doesn't exist"

 

What could I be doing wrong?

ChampionIS
Level: Power Up

Re: Submit a Collection to a SharePoint List

Hi Winston, In case you have not found the answer to this, You will need to check the SharePoint column names. Go to the SP list advanced properties, click on column name and check the end of the URL to make sure it is correct; it may be set as the 'Title' column: