Hi,
Long story short is: I'm trying to insert new data into the SharePoint list where I obtain data from. I'm using custom forms so the functionality for the default insert no longer works. My editing still works.
Can someone please advise me on a way to do this in lets say an on button press?
Thanks!
Solved! Go to Solution.
All the required fields need to be specified in a Collect. The ones that are not required by SP can be ommitted. Some thoughts:
Do any errors show up on the button/visual after you press? (after OnSelect is re-evaluated)
You can insert using PowerApps language functions, for example Patch or Collect:
Patch(datasource, row_to_change, record_with_changes)
Collect(dataSource, new_row)
Since you are using a custom form, you will need to assemble the row yourself. (non-custom forms do this automatically on your behalf):
Collect(MySPList, { ID: input1.Text, Name: input2.Text, Age: slider3.Value, ........ })
If you need to edit an existing row, use Patch:
Patch(MySPList, row_to_change, { Name: "new name" })
Any one of these operations can be performed from an action, such as the OnSelect property of a button:
SubmitButton.OnSelect = Collect(MySpList, { Id: 2, Name: "Joe" })
I hope this helps.
Hey,
Thanks for the clear and consice answer.
I tried your suggestion but with no luck. Are you required to enter all the columns manually? "Title" is a required field.
I tried the following:
OnSelect = Collect(list, {ID: (Last(list.ID).ID +1), Title: "test", Week: (Last(list.Week).Week + 1)})
I then tried to simplified to:
OnSelect = Collect(list, {ID: 9, Title: "test", Week: 9})
Any suggestions to why this isn't working?
Cheers!
All the required fields need to be specified in a Collect. The ones that are not required by SP can be ommitted. Some thoughts:
Do any errors show up on the button/visual after you press? (after OnSelect is re-evaluated)
ID is a field that is generated by SharePoint. So, you should not provide a value for that. You need to specify values for all required fields.
Doing
Collect(list, {Title: "test", Week: 9}) should work.
You could also do
Patch(list, Defaults(list), {Title: "test", Week: 9}) to ensure you get the default values that are specified on SharePoint for certain fields.
Thank you
Murali
Can We send another collection to sharepoint list ? For Eg : Collect(MySPList,MyAnotherCollection)
Yes, that should work, as long as the schemas match.
Hello , I have only one column in my sharepoint list which is Single Line Data Type and my collection also has only one column but still I am unable to save all my data from a collection to a sharepoint List.
Can you help understand how to match the values from the form and my sharepoint list ?
Nerver mind. Figured it out.
Do you know what's the relationship between a form a browse gallery ?. If I don't specify a Browse Gallery my from shows up as blank.
User | Count |
---|---|
246 | |
103 | |
82 | |
49 | |
42 |