cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lefty
Post Prodigy
Post Prodigy

Problems submitting an edited record/item

Hi everyone,

 

This is the first time, in my canvas app I'm allowing users to edit an already submitted request, as this was not a requirement is previous forms.

I'm unsure how I do this.

  • I have deep linking set up, allowing a user to navigate to there submitted record. ✔️
  • Created an edit button for the user to be able to edit the items, edit button on each screen becomes active using 1 variable ✔️
  • The form spans across 5-7 screens, so I assumed I had to use the same code I had on my new form but by doing so it created a new record in my SharePoint list :

 

UpdateContext(
	{
	vPatchedRecord:
	Patch(
		List, Defaults(List),
		FormHome_2.Updates,
        FormPartB_1.Updates,
		'FormPartC/D_1'.Updates,
        'FormPartE/F_1'.Updates,
        FormPartFGH_1.Updates
    ) 
	}
);​

What do I need to do to be able to edit and save to the same submitted record using the above forms please? 

 

24 REPLIES 24

Thanks @Lefty ,

It also should be VarRecord.ID if you were setting it from the gallery, although you still did not tell me the Items of your gallery.
We need to solve this in the reverse - you need the ID if you are going to Patch in the manner you want, so make it available in the gallery. You have to design your program this way and you need the ID (I always have it available as a Variable for a whole heap of references). You can however now refer to the label you put in one of the forms.

UpdateContext(
   {
      vPatchedRecord:
      Patch(
         List, 
         {ID:Value(YourLabelName.Text)},
         FormHome_2.Updates,
         FormPartB_1.Updates,
         'FormPartC/D_1'.Updates,
         'FormPartE/F_1'.Updates,
         FormPartFGH_1.Updates
      )
   } 
)

I am trying to help you when I ask that you please understand the full concept of some of this quote complex code you are writing - it will assist you greatly in your Power Apps journey. Our role at the forum is to guide you to a solution.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@WarrenBelz 

Thanks I will give this try, just a few questions, you mentioned:

It also should be VarRecord.ID if you were setting it from the gallery
Where do I need to change it to VarRecord.ID? Having attempted to change it  on the item property of the form, "I get invalid formula. Expected a value with datasource"

Items of your gallery - I have set it to Filter(ListName,
'Created By'.Email = VarUser ||
VarUser = ArName.Email) 

 

you need the ID if you are going to Patch in the matter you want, so make it available in the gallery - How do I make this available in the gallery?

 

If possible could you put a 1 liner next to some of the code you have provided, so I can understand what is going on, you are correct, understanding the code will help as I'm stuck

 

Hi @Lefty 

Your Gallery Items are

Filter(
   ListName,
      'Created By'.Email = VarUser ||
      VarUser = ArName.Email
) 

The gallery data has to contain the ID as you have not excluded it with ShowColumns/DropColumns. If you put a label in the gallery (not on the gallery) with ThisItem.ID, it has to be there. If you use YourGalleryName.Selected.ID, it has to be there.  My comment on making it available is not necessary - it already is.
You are setting

Set(VarRecord, ThisItem)

when you select the gallery.
This is setting VarRecord to the entire record selected in the gallery. The ID is "inside it" and can be referenced as VarRecord.ID.
Are you now able to reference the Patch?

 

@WarrenBelz 

Hats off to you, you are a genius for explaining this to me!

And yes it's successfully patched my list item, it didn't trigger my email, or navigate to a SucessScreen, but hopefully I will be able to figure that out

Thank you so much on this. I'll look to apply the same logic on the other similar question you have also helped with, with setting the N/A once a get a chance and mark that as an accepted solution once i've tried it and working on that.

 

👍

Thanks @Lefty ,

I am glad I could help you on your journey. I will use the same methods on the other post when you get to it.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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
Users online (2,225)