I recently upgraded my Microsoft Dynamics CRM 2011 On-Premises to CRM 2013. I did a Migration Upgrade, moving from CRM 2011 on Windows Server 2008 R2 & SQL 2008 R2 to CRM 2013 on Windows Server 2012 & SQL 2012. All appeared to go well, at first. Then I started getting Unexpected Error when I attempted to access Account records. At first I thought my database was corrupt (and I hadn’t yet started my backups) (I know, I know…) I could go back to my 2011 (with backups) but then I’d have to figure out what updates I’d made in 2013 and re-enter them (or not). I did notice that it only occurred on some Account records. So I decided to do a Bing search to see what might be there. Much to my delight I quickly found an article from another with the same problem. But he had solved it! His article is here.
Seems this error occurs on CRM 2013 databases that have been updated from version 2011, like mine. The Merged attribute in the AccountBase table should be either a 1 or a 0. But with the upgrade, some records come over with a null instead of a 0. The solution is to run a simple SQL script that looks for Accounts where the Merged attribute is null and set it to 0. I had to modify the database references to run in SQL Management Studio. Here is the script I used (basically the same as in the article I found, but with database reference):
SET A.Merged = 0
from My_Organization_MSCRM..AccountBase A
WHERE A.Merged is null
Note, there are 2 dots between _MSCRM and AccountBase
I’ve tried this on a few records that had previously produced the error and they opened fine. Hopefully that will continue. And yes, I have instated my Maintenance Plan with a daily backup.