Monthly Archives: November 2013

Assignrequest: Unsupported entity type while converting to security principal

The other day at work, I encountered the following error message, one for which I could not find a solution online. (Unfortunately, some of the text is in Dutch. However, the error message is in English and the error code is universal!)

Error detail: Unsupported entity type while converting to security principal
Error code: -2147220891
Error:

[csharp]
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Er is een onverwachte fout opgetreden, probeer het later opnieuw. Neem contact op met uw systeembeheerder indien dit zich vaker voordoet. Foutinformatie: Unsupported entity type while converting to security principal
Detail:
-2147220891
OperationStatus
0

Er is een onverwachte fout opgetreden, probeer het later opnieuw. Neem contact op met uw systeembeheerder indien dit zich vaker voordoet.
Foutinformatie: Unsupported entity type while converting to security principal

[(..details left out for customer discretion..)]
[5f789a7e-1037-e311-b1ea-005056b615c4: PostAccountUpdate]
Now running under user id 67e96c02-99d1-e211-b13f-005056b615c4., Correlation Id: 258be446-76fc-423a-bc8b-f8f3587ed188, Initiating User: 67e96c02-99d1-e211-b13f-005056b615c4
Entered (..details left out for customer discretion..).Execute(), Correlation Id: 258be446-76fc-423a-bc8b-f8f3587ed188, Initiating User: 67e96c02-99d1-e211-b13f-005056b615c4
(..details left out for customer discretion..) is firing for Entity: account, Message: Update, Correlation Id: 258be446-76fc-423a-bc8b-f8f3587ed188, Initiating User: 67e96c02-99d1-e211-b13f-005056b615c4
<strong><span style="text-decoration: underline;">Fatal Error: </span><span style="text-decoration: underline;">Unsupported entity type while converting to security principal</span></strong>
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [1]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)
at (..details left out for customer discretion..)
at (..details left out for customer discretion..)
Exiting (..details left out for customer discretion..).Execute(), Correlation Id: 258be446-76fc-423a-bc8b-f8f3587ed188, Initiating User: 67e96c02-99d1-e211-b13f-005056b615c4

[/csharp]

The lines of code that caused this error were:

[csharp]
var assignRequest = new AssignRequest()
{
Assignee = team,
Target = account
};

organisationService.Execute(assignRequest);
[/csharp]

Closer inspection of the assignment of the team variable (which in code is assigned to the Assignee property) showed that it was not an EntityReference to a record of entity type SystemUser or entity type Team.

The Assignee must always be an EntityReference to a record of entity type SystemUser or Team, or you will encounter the exception as shown in this post.