cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

"Submit" after "Edit All" creating a new item in SharePoint

Hello Friends, 

I'm having an issue with SharePoint integration and I can't find a solution that is specific to my needs.

 

When opening the PowerApp in the SharePoint list to make edits ( via "Edit All"), my submit button creates a new item instead of updating the forms. I have more than one form on the screen to submit. 

 

My submit button formula is: 

Patch('PCAR- Testing',Defaults('PCAR- Testing'),Form4.Updates,Form5.Updates,Form6.Updates,Form7.Updates,8.Updates)

 

If I'm using .Updates, I'm not sure why it is creating a new item. I am also very NEW at powerapps. Any and all help is appreciated.

 

Thanks! & Happy Holidays Everyone

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @ebraga ,

 

The major source of conflict is Defaults('PCAR- Testing'). Defaults function in Patch is to create a new record. Reference: Patch .

You have to add a condition into Submit button to check if the form is in Edit or New mode. Put the following codes to OnSave property of SharePointIntegration.

 

Patch('PCAR- Testing',If(SharePointForm1.Mode=FormMode.Edit,SharePointIntegration.Selected,SharePointForm1.Mode=FormMode.New,Defaults('PCAR- Testing')),SharePointForm1.Updates);ResetForm(SharePointForm1); RequestHide()

 

 Sik

View solution in original post

2 REPLIES 2
Dual Super User III
Dual Super User III

The problem is in your Patch statement on the submit. When the second parameter of a patch statement is set to defaults(datasource) it will always create a new record. To update an existing record you need to supply something that selects the specific record you want to update as the second parameter.  This is usually a Lookup.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support
Community Support

Hi @ebraga ,

 

The major source of conflict is Defaults('PCAR- Testing'). Defaults function in Patch is to create a new record. Reference: Patch .

You have to add a condition into Submit button to check if the form is in Edit or New mode. Put the following codes to OnSave property of SharePointIntegration.

 

Patch('PCAR- Testing',If(SharePointForm1.Mode=FormMode.Edit,SharePointIntegration.Selected,SharePointForm1.Mode=FormMode.New,Defaults('PCAR- Testing')),SharePointForm1.Updates);ResetForm(SharePointForm1); RequestHide()

 

 Sik

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,245)