Hi all!
I'm having an on-and-off error when submitting a form for my table "Custom Table" in my PowerApp. If I delete a record in my custom table and then try to recreate it (with the same value in the Primary Name Column) by adding a new record, I get this error:
The specified record was not found. Server Response: Custom Table failed: CustomTable with ID = (GUID of the record I deleted) Does Not Exist
Like I said, this only happens when I delete a record in my custom table and then immediately try to recreate it. It actually doesn't even seem to prevent anything from happening, as the form still submits properly. I just don't want the error to persist for risk that it suddenly breaks my app.
I'm not sure if this makes a difference, but I do have some many-to-many related columns in my form for Custom Table. I used the following blog post to be able to submit my many-to-many columns:
How to Implement a Common Data Service Many-to-Many Field on Canvas Power Apps – ReadyXRM
I have the code to submit my many-to-many columns after SubmitForm() on the OnSelect property of the button I use to submit my new record in Custom Table.
Please let me know if I need to give more information.
Thanks!
Solved! Go to Solution.
Hi @jacktransform,
After the delete operation, try to do a Refresh? Although the Remove should refresh, I think the canvas app still thinks the record exists so maybe an explicit refresh would work. For exmaple:
Remove(Datasource, recordx); Refresh(Datasource)
Hope this helps...
I actually did something slightly different. I had to breakup what I had in my OnSelect property to be half on OnSelect and the later half on the OnSuccess property of the form I was submitting (eg: CustomTableEditForm.) Below is an example of my code (keep in mind I am editing many-to-many columns in my edit form. The many-to-many related table is named 'Many to Many Table')
In the OnSelect property of my save button:
ClearCollect(manyToManyCollection, manyToManyCardValue.SelectedItems);
SubmitForm(CustomTableEditForm);
Set(varNewRecord, Blank()) // Necessary for next step
In the OnSuccess property of my edit form, CustomTableEditForm:
Refresh([@'Custom Tables']);
Set(varNewRecord, CustomTableEditForm.LastSubmit);
ForAll(
manyToManyCollection,
Relate(
varNewRecord.'Many to Many Table', ThisRecord
)
);
This seemed to clear the issue up. Thanks again for your help!
Hi @jacktransform,
After the delete operation, try to do a Refresh? Although the Remove should refresh, I think the canvas app still thinks the record exists so maybe an explicit refresh would work. For exmaple:
Remove(Datasource, recordx); Refresh(Datasource)
Hope this helps...
I actually did something slightly different. I had to breakup what I had in my OnSelect property to be half on OnSelect and the later half on the OnSuccess property of the form I was submitting (eg: CustomTableEditForm.) Below is an example of my code (keep in mind I am editing many-to-many columns in my edit form. The many-to-many related table is named 'Many to Many Table')
In the OnSelect property of my save button:
ClearCollect(manyToManyCollection, manyToManyCardValue.SelectedItems);
SubmitForm(CustomTableEditForm);
Set(varNewRecord, Blank()) // Necessary for next step
In the OnSuccess property of my edit form, CustomTableEditForm:
Refresh([@'Custom Tables']);
Set(varNewRecord, CustomTableEditForm.LastSubmit);
ForAll(
manyToManyCollection,
Relate(
varNewRecord.'Many to Many Table', ThisRecord
)
);
This seemed to clear the issue up. Thanks again for your help!
User | Count |
---|---|
37 | |
21 | |
14 | |
4 | |
3 |
User | Count |
---|---|
37 | |
31 | |
24 | |
7 | |
7 |