Mr.X
Mr.X

Reputation: 31345

An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide

Following this blog, we've setup the SaveAccount method inside DAL_AccountEntity.cs class for our Microsoft Dynamics CRM SDK project.

Whenever we try to add a new record using OrganizationService.Create

It throws the following error:

Server Error in '/' Application.


An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide.

Exception Details: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide.

Source Error:

Line 28:                 if (objAccountModel.AccountID == Guid.Empty)
Line 29:                 {
Line 30:                     objAccountModel.AccountID = service.Create(AccountEntity);
Line 31:                 }
Line 32:                 else

Upvotes: 0

Views: 1270

Answers (2)

dynamicallyCRM
dynamicallyCRM

Reputation: 2990

This line looks fishy

AccountEntity["primarycontactid"] = new Microsoft.Xrm.Sdk.EntityReference { Id = objAccountModel.PrimaryContact.Id, LogicalName = "account" };

The Id assigned is of the object PrimaryContact but the LogicalName is set as account, try changing the LogicalName to contact or try assigning the correct accountid.

Upvotes: 1

Jordi
Jordi

Reputation: 1470

If you are using an OnPremise, try adding includeExceptionDetailInFaults in the CRM's web.config so that you can get more information of the exception, or alternatively, look for errors in the Server's event viewer where CRM is installed.

Maybe the connection string is wrong, or the user account doesn't have access, it could be anything without knowing the exception details...

Upvotes: 2

Related Questions