Record is Unavailable error opening attachments in Notes - Dynamics CRM

CRM crm2013 error troubleshooting attachments notes

Today I encountered a problem in a Dynamics CRM 2013 environment, the resolution for which reminded me that sometimes a good old fashioned browser cache empty isn't such a lame idea. (TL;DR Empty your browser cache if you get this error)

We have a system where we generate a file, save it as an attachment to a Note against a particular entity. The Note is owned by the user who initiated this action. In our case, every time the user clicked on the file they would see the following error:

Screenshot - The requested record was not found or you do not have sufficient permissions to view it

Record is Unavailable

The requested record was not found or you do not have sufficient permissions to view it

This error opened up in a new tab in Internet Explorer, and it happened pretty quickly (i.e. it was hard to see if a request was being made to the server at all). I couldn't find any errors being logged on the server side. The Note (and therefore the file attached to it) was created by the user, so I couldn't see any reason permissions were a part of the problem.

As a workaround, I performed an Advanced Find and found the notes. From the results there I could open the file and download it. This ruled out permissions as a problem, and indicated some kind of problem with the entity form perhaps? The error was occurring across multiple records, all of which I could open if I went via the Advanced Find route.

I tried logging into the CRM with an Internet Explorer InPrivate browsing session, and lo and behold the files downloaded when the user clicked on the link - same form, same user.

That made me think there was some browser issue at play - I didn't have another browser available to verify. In the end, I emptied the browser cache and reloaded CRM. The problem was now fixed and I could download the files.

To me it looked like some element of the form / common JavaScript for that entity was corrupted in the browser cache. As I said at the start - sometimes good old fashioned techniques are still relevant in 2016.