I'm new to Power Apps so I need some assistance with a task that may be very simple. I have created a form for a SharePoint list that includes a DataTable that is populated with items from a second SharePoint list. I would like to add a button that can be used to add items to the second SharePoint list. The form looks something like this:
The lower part of the form is the DataTable that is populated with items from the second SharePoint list. I would like the "Add Item" button to open up a form for creating a new item in the second SharePoint list.
I assume that the correct place to add the code is the OnSelect field in the ACTION section for the button. I'm just getting stuck finding the correct code.
Thanks for your help!
Hi @Kjell how did you insert the DataTable populated with items from the second SharePoint list?
I'd like to have the same solution but on the same SharePoint list and filtered.
Thank you very much.
Hi Sik,
Thanks for your reply. This does indeed open up the form that I'm looking for.
Hi Paul,
Thanks for your reply. It may not be exactly was I was looking for since I wanted to display the form for creating a new item. I may have to create items this way as well though so your suggestion is very much appreciated.
What does it mean when you said: "open up a form for creating a new item in the second SharePoint list"?
If you mean to open a New Item page from SharePoint, you can use Launch() function to open it, set the OnSelect of button as below:
Launch("https://<Domain>.sharepoint.com/sites/<SiteName>/Lists/<ListName>/NewForm.aspx")
Note: modify the URL to your own New item page.
Sik
You'll want to use the Patch function:
Patch([SharePointList], Defaults(SharePointList),
{Field1: Value1,
FIeld2, Value2,
...
})
SharePointList is the list you are patching (inserting) into.
Field1 is the name of a field in that list - Value1 is the value you want to set it to. If the Field is PartNumber and the value you want to insert into it is in a label called lblPartNumber then it would be like this:
{PartNumber: lblPartNumber.Text}
WarrenBelz
44
Most Valuable Professional
mmbr1606
41
Super User 2025 Season 1
MS.Ragavendar
36