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.
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?
Solved! Go to Solution.
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
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: -
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:
User | Count |
---|---|
157 | |
93 | |
80 | |
74 | |
57 |
User | Count |
---|---|
202 | |
166 | |
98 | |
94 | |
79 |