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 @WarrenBelz 

 

Sorry, I think your code on this one is correct and the issue I am facing is it won't work for me, because of what I am trying to use in {ID:VarID} or if I use {ID:vRecord}

Neither work.

{ID:VarID} i get an error "The specified record was not found. Server Response List failed: Item not found"

This is what I have on my App OnStart

Set(VarID, Value(Param("Cov")));
If(VarID <> 0,Set(vRecord, LookUp(List,ID = VarID));Navigate(ViewScreen));

 I'm not sure if you can help please?

Hi @Lefty ,

 

Thought i also put my 2 cents in.

 

an UpdateIf/Patch need to know the record in the second parameter. Just an ID won't work. I usually do:

 

 

 

Lookup(<listName>,ID = varID)

 

 

 

Which should return a record you can patch. Using your vRecord variable will not work

in the second parameter, The lookUp works on my side.

 

Your complete code should look something like this:

 

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

 

If it's still not finding a record, i would doublecheck if the ID is used, and what value the variable ahs in the app before patching

@PVosEska 

 

Thanks for explaining, makes sense (i think), I've tried that but nothing happens, not getting that error anymore, but it isn't submitting the form.

 

I've put a label on the screen, and checked what value VarID has, and its 0 which is strange as it should be 2, based on the SPO list ID field.... any ideas? 

Then my guess is the 'Param' function is not filled correctly from your previous app. If the ID is 0, your patch won't find anything to update, since there is no ID:0 in your list.

 

I would start to look at how the param is created, if you can't find the cause, you can share the code with me if you want.

hi @PVosEska 

Thanks for helping with this

The only reason I am using this bit of code on my App OnStart is so I can have deep linking working correctly and it is, when a user submits a form, the link provided to them takes the user directly to the form  when the link is clicked:

Set(VarID, Value(Param("Cov")));
If(VarID <> 0,Set(vRecord, LookUp(List,ID = VarID));Navigate(ViewScreen));

 thats the only bit of code I have on my App OnStart related to deep linking, and i presumed I would use the same variable for when im trying to patch an existing record, but as you know its not working

What else will you need to help me with this problem please?

@Lefty ,

Back in my time zone,

Yes - I assumed your Parameter was correct to identify the record and was dealing with the syntax for the rest of it.

This should not be hard to solve - you simply need the ID of the record you are patching. 

Put a label in a card on the form with ThisItem.ID, then another one with VarID - are they the same? If so

UpdateContext(
   {
      vPatchedRecord:
      Patch(
         List, 
         {ID:VarID},
         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 

 

I couldn't place a label anywhere but inside my gallery, which had ThisItem.ID, I have done so and I can see each record is picking up the correct ID number from SPO

But VarID in another label again next to the above label, shows 0 for all the records... and i'm unsure how to generate the correct number inside VarID... if you read my previous response to the other helper, i did mention that deep linking is working fine, and takes the user to the correct submitted form, using the VarID and another variable.... so I'm really stuck in how to get this to work... I had got help from other people here to get deep linking working, so pretty much stuck now

Hi @Lefty,

 

I hope @WarrenBelz  can help you. If you can't get this to work, would it be a possibility to just use the SubmitForm() Function on your Submit-button ?

SubmitForm(Form1);
Submitform(Form2)

 On each Form, you would have to change the FormMode to 'Edit' (instead of 'New') and the Item property to LookUp(List,ID = VarID).

 

OR name every column in the patch, that's what i usually do

 

Patch(List,LookUp(List,ID = VarID),{Column1:DataCardValue1.Text,Column2:DataCardValue2.Text})

Or share the app package, and i can import it here and see what is wrong.

Hi @Lefty ,

 This should be a really easy solution - every SharePoint item has an ID, which is the fundamental way you generally refer to it. I will give you some options below: -

  • Do you select the form from a Gallery? if so it will be GalleryName.Selected.ID.  If not available, what are the Items of the gallery?
  • What is the Item of the forms you display the current record in?
  • What is the Value of VarID  when the deep linking works - it should also be the ID. If not, how is your deep linking working when it is using this value?
  • You have five forms - put a label in any card (you will have to unlock it) with the text ThisItem.ID and you should see it.

 

 

Hi @WarrenBelz 

Thanks, the suggestion @PVosEska  made about submitting multiple forms, but due to another similar issue on another form it would really help me if we got this working.
In respond to you Warren:

  • Do you select the form from a Gallery? if so it will be GalleryName.Selected.ID.  If not available, what are theItemsof the gallery? Yes a user can select the item from my Gallery, by clicking on the item, the OnSelect of the item I have set to: Set(VarRecord, ThisItem); 
  • What is the Item of the forms you display the current record in? Item property has been set to VarRecord
  • What is the Value of VarID  when the deep linking works - it should also be the ID. If not, how is your deep linking working when it is using this value? Yes this is correct, so I can see in the email the user receives, the URL contains the  the correct ID, this is why it allows navigation to the correct item.... but when I type in VarID in my form it shows 0 for all the items
  • You have five forms - put a label in any card (you will have to unlock it) with the text ThisItem.ID and you should see it.
    Ah I see, yes I have done that and after clicking on an item from my Gallery, I have then added in a label inside a datacard, and put ThisItem.ID and it also correctly shows the number 2, which is the correct number for that record.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,792)