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? 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

24 REPLIES 24
WarrenBelz
Super User
Super User

Hi @Lefty ,

Defaults(List) will always create a new record. I cannot test this, but try the below.

UpdateContext(
   {
      vPatchedRecord:
      UpdateIf(
         List, 
         ID=YourIDIdentifier,
         {
            FormHome_2.Updates,
            FormPartB_1.Updates,
            'FormPartC/D_1'.Updates,
            'FormPartE/F_1'.Updates,
            FormPartFGH_1.Updates
         }
      ) 
   }
)

 

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.

 

HI @WarrenBelz 

 

Thanks for your response, I have tried the following based on your suggestion, where vRecord is my submitted record, set on my gallery item:

UpdateContext(
	{
	vPatchedRecord:
	UpdateIf(
        List, ID=vRecord,
		{
        FormHome_2.Updates,
        FormPartB_1.Updates,
	'FormPartC/D_1'.Updates,
        'FormPartE/F_1'.Updates,
        FormPartFGH_1.Updates
        }
    ) 
	}
);

Hovering over UpdateIf - "The function UpdateIf has invalid arguments"
Hovering over the second form:

updateIf.PNG

any ideas what I'm missing, or have i missed something you have already provided!

WarrenBelz
Super User
Super User

Hi @Lefty ,

Danger of free-typing - curly brackets not needed for Updates

UpdateContext(
   {
      vPatchedRecord:
      UpdateIf(
         List, 
         ID=vRecord,
         FormHome_2.Updates,
         FormPartB_1.Updates,
         'FormPartC/D_1'.Updates,
         'FormPartE/F_1'.Updates,
         FormPartFGH_1.Updates
      ) 
   }
)

 

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.

@WarrenBelz 

Sorry still cant get it to work

 

getting updateif function has invalid arguments:

UpdateContext(
	{
	vPatchedRecord:
	UpdateIf(
        List, ID=vRecord,
	FormHome_2.Updates,
        FormPartB_1.Updates,
       'FormPartC/D_1'.Updates,
        'FormPartE/F_1'.Updates,
        FormPartFGH_1.Updates
        
    ) 
	}
);

sorry, i cannot spot what it needs

@Lefty ,

Get rid of the UpdateContext for the moment, then add the Updates one at a time.

@Lefty,
Forget about that - I should test the whole thing together - you need

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

 

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.

@WarrenBelz 

 

Thanks

This is what I have done.

Removed:

 

/* UpdateContext(
	{
	vPatchedRecord:*/

 

 

 

UpdateIf(
  Covid, ID=VarID, //I've changed this as i think this needs to be VardID based on my app onstart code
  FormHome_2.Updates
);

 

Keeping just this much and it doesnt complaint, tried clicking on the submit button, to see if it takes this 1 update, but clicking the button does not do anything, as my code is not OnSuccess, rather its on OnSelect

 

Sorry forgot to add, as soon as I add the second form in the code, it starts to complain 

@Lefty ,

Please read my second post - like a lot of things I do not use a lot, the syntax is not obvious, UpdateIf will only take one FormUpdates, so go back to Patch (which has it s own issues in some cases).

@Lefty ,

 I will be offline shortly due to time zone - I will pick up any responses in the morning.

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
Top Kudoed Authors
Users online (2,734)