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

4 REPLIES 4
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

View solution in original post

Kjell
Regular Visitor

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.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Top Solution Authors
Top Kudoed Authors
Users online (4,100)