cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kjell
Regular Visitor

Program Power Apps Form Button to create new SharePoint list item

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:

 

Screen Shot 1.jpg

 

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!

 

Screen Shot 2.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

@Kjell

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.

StoG_19.gif

Sik

View solution in original post

5 REPLIES 5
PaulD1
Super User
Super User

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}

v-siky-msft
Community Support
Community Support

@Kjell

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.

StoG_19.gif

Sik

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.

Hi Sik,

 

Thanks for your reply.  This does indeed open up the form that I'm looking for.

MI2022
Frequent Visitor

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,701)