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

How to edit a record in powerapps

I have been struggling with how to update an existing record in PowerApps. The fields are not in a default Edit Form, but text inputs in a screen.

 

It is no problem creating a new record, but when I try to edit the record I receive an error message saying "The Requested operation is invalid. Server Response: 'Data source' failed: The list item could not be added or updated because duplicate values were found in the following field(s) in the list: [Title]. clientRequestedID"

 

I have attempted with patch function, but then only a new record is created instead of updating the record, which is what I need it to do.

 

Info about the PowerApps (Canvas):

 

Data source: 4 different lists in SharePoint

 

The submit button for the "create a New record" and "Edit record" (On select):

Submit Form(nyFPinfo);;

Set(

varRecord;

{

Title: inpTittel_1.Text;

Region: inpRegion.Text;

Type: inpType.Text;

Status: "Active";

}

);;

Set(

varEdit;

true

);;

Navigate(Details)

 

What I have attempted to be able to edit the record (On select):

EditForm(nyFPinfo);

Patch(

FP_plans,

LookUp(

FP_plans,

Title = varRecord.Title

),

{

Title: inpTittel_1.Text,

Region: inpRegion.Text,

Type: inpType.Text,

Status: "Active"

}

)

 

I'm not able to edit the record, any suggestions?

2 REPLIES 2
RandyHayes
Super User
Super User

@Linn93 

You mention that this is just a bunch of hand made controls as your form, but your formula seems to suggest that you have a form (it has a submit form in it).  So, is this an edit form or not?

If it is an edit form, then there is no need for any of the patching or anything else you are doing, but I need to know if you are in fact using a form or not.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Linn93
Helper I
Helper I

The screen has controls that are referring to an edit-form which is in a hidden screen. When I use the Edit Form function, I receive the error message when I try to edit the Title Field; "The Requested operation is invalid. Server Response: 'Data source' failed: The list item could not be added or updated because duplicate values were found in the following field(s) in the list: [Title]. clientRequestedID"

 

I.e. I am not able to edit the record. What would be the easiest way to be able to edit the record? should I use Patch instead of referring to the edit form, which is hidden?  If so, how should I write the formula? 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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