General exception while creating an appointment in CRM 2011
Some time ago I had a serious problem when I tried to add the apppool user to CRM 2011. When I did that, not a single user could access CRM2011 anymore. I think, not sure, that it had something to do with the AD groups where the apppool user is a member of. I think that when I added that user to CRM2011 something changed and it messed up the windows permissions of that user. The trick was to delete every record manually from the CRM 2011 database where that user’s GUID was linked to. I know it’s not supported but it solved my problem.
Today I was trying to create an appointment and this resulted in a General Exception. Pretty weird but immediately I thought it had something to do with that same user from a couple of weeks ago because the GUID showed up in the errorlog:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Pointer record exists but referenced record of type 8 not found: aa60799f-49a3-e111-8444-000c29cbd80b
Scratching my head I was thinking: what can I do now? I thought I went through every table in CRM 2011 looking for that systemuserid.
I enabled tracing to see what exactly was going on. In the log I found the following query:
SELECT TOP 1000 [DisplayInServiceViews]
,[ObjectTypeCode]
,[BusinessUnitId]
,[CalendarId]
,[IsDisabled]
,[ResourceId]
,[VersionNumber]
,[OrganizationId]
,[Name]
,[SiteId]
FROM [LRMDEPLOYMENT_MSCRM].[dbo].[ResourceBase]
This is the point where the error was returned. Now I knew that I missed a table. When an appointment is created CRM2011 probably tries to lookup all the available resources for scheduling. In this table there was still a reference to that “bad” userid and it resulted in an error. I removed this record and I could create my appointment.