Forum Discussion
How do I submit data to SharePoint list using Power Apps form
RenPNW First, ensure you have created a data source in Power Apps that connects to your "GOS Daily Log v24" SharePoint list. Then, in your form's OnStart property, you'll want to create a collection to hold the form data and populate it with the default values from the list using the Defaults function. Next, set the form's DataSource property to this collection.
This will bind the form controls to the collection, allowing users to input data. When it comes to submitting the form, you'll use the Patch function in the OnSuccess property. The Patch function will update or create a new item in the SharePoint list based on the data in your collection. Specifically, the Patch function takes three arguments: the data source (your SharePoint list), the item to update (or Defaults for a new item), and the collection holding the form data. After a successful submission, you can clear the form data by repopulating the collection with the default values from the list. If you need to edit an existing item, you'll retrieve the item's data from the SharePoint list in the OnEdit property using the LookUp function.
This function takes the data source and the identifier of the item you want to edit (such as the ID column) as arguments. The retrieved data will then populate the form for editing. Throughout this process, I'll ensure proper error handling is in place, particularly for the "Network error when using the Patch function" issue, which may be due to permission restrictions or other factors.