cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Maximilian
Helper I
Helper I

SubmitForm makes changes but gives an error: "Specified record was not found"

Hey guys.

 

I have an entity that I am using in PowerApps and it has a field "Checked" with two values: "Yes" and "No". By default all of them are selected as "No", but if it becomes a "Yes" - then it disappears from the entity. It is no longer is there, so basically it gets deleted.

 

The thing is, when I submit form with "Checked" field set to "Yes", it makes the changes to the item that is being edited in the form, submits them but shows an error:

The specified record was not found. Server response: NotFound

So for some reason PowerApps tries to lookup this field again and finds out it is not there (therefore shows the error). However everything works for me as intended but PowerApps decides to show the error, which is a problem.

 

Do you guys think it is possible to surpress the error or make a workaround for this? Or am I forced in this situation to edit the entity not to delete the record if its' "Checked" field is set to "Yes"?

3 REPLIES 3
Drrickryp
Super User
Super User

Hi @Maximilian,

 

It looks like you are using CDS.  Please correct me if that is not the case. If so, what is the Data Type of the Checked column?  What are the OnCheck OnSelect and OnUncheck properties of the Checkbox control?

Hey @Drrickryp,

 

Correct, I am using CDS, specifically - Dynamics 365 for Finance & Operations. Let me explain how my form works, here's a visual representation:

error.png

 

I have an entity with lists of deliveries that have come to my place and that need to be checked for quality. Once they are checked - they disappear from the entity as they are no longer needed. The purpose of the application is to check all the received deliviries, which opens up the form above. User has options to change the visual quality of the delivered product and mark if it needs to be scrapped. Once button "Save" is pressed (dark blue box on the right, where the error is), it is marked as "Checked" - Yes. Checked is an enum data type which is hidden in this form because it is being changed without user knowing.

 

Here is the formula for my "Save" button OnSelect property:

UpdateContext({CheckedVar: "Yes"});SubmitForm(EditForm)

CheckedVar is being used for "Checked" field hidden dropdown, once saved it is being marked from "No" -> "Yes". Checked dropdown Default property:

CheckedVar

By default Checked dropdown is set to "No" when the edit screen is being opened. EditForm screen OnVisible property:

UpdateContext({CheckedVar: "No"})

Whenever the item from entity is saved in this form, it disappears from entity. Everything works very well and as intended, but it shows to me the error that the record no longer can be found (after changes are saved and patched) - which is totally fine, because the edited record is supposed to disappear from data source once saved.

 

I've thought about making records not get deleted if their "Checked" field is set to "Yes", but then I will eventually build up an entity with a lot of records that will take time to filter out the ones that are checked.

 

tl;dr My form upon making changes to a record makes it disappear from entity as intended, but for some reason PowerApps tries to lookup it again (after submitting form) in the entity - therefore shows the error. Can't find a way to surpress it or work around it.

 

I am a little confused with what I could do with the error. I hope you could guide me to a conclusion. Thanks!

@Maximilian 

 

Were you ever able to resolve this issue? I get this error when I delete a record then try to re-create it. Like you it doesn't cause the form to not submit successfully, it just throws this error.

 

Thanks!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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