cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ebraga
Level: Powered On

"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
Microsoft v-siky-msft
Microsoft

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

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
Dual Super User

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

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.
Microsoft v-siky-msft
Microsoft

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

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,525)