Note that there are some explanatory texts on larger screens.

plurals
  1. POMicrosoft.Xrm.Sdk.SaveChangesException in CRM 2011
    text
    copied!<p>I recently started working with plugins in CRM 2011 and I am facing issues with plugins registered on the Create message as a Post-operation. </p> <p>When I register the create as a post-operation, I would expect that when I hit the plugin code, the entity has already been created in the database and I should be able to create a related entity(related to the newly created entity by a foreign key) in the plugin. But when I create the related entity and update it, and say SaveChanges(), it gives me a Microsoft.Xrm.SaveChangesException "An error occurred while processing this request"</p> <p>And if I drill down to the inner exception, it just points to the OrganizationServiceFault. The stack trace it shows is:</p> <blockquote> <p>Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; 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)</p> <p>Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type) at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results</p> </blockquote> <p>I face this issue only on the create message, if I do the same operation on an update or delete, it works fine. Has anybody faced this issue? Please provide some inputs on the what I can try to resolve this issue. Thanks in advance!</p> <p>Also, here is my plugin code.</p> <p>The plugin gets fired when the ct_repcode entity is created and then in my plugin I create a ct_repcodeMember entity which has a ct_repcodeid field which links to the actual ct_repcode entity.</p> <pre><code>Entity repcodeEntity = _context.InputParameters["Target"] as Entity; Guid repcodeId = repcodeEntity.Id; //Create a new Ct_repcodemember object Ct_repcodemember repcodeMember = new Ct_repcodemember(); Guid repCodeMemberId = _service.Create(repcodeMember); repcodeMember = _serviceContext.Ct_repcodememberSet.Where(a =&gt; a.Id == repCodeMemberId).FirstOrDefault(); repcodeMember.ct_repcodeid = new EntityReference { Id = repcodeId }; //Update the object and save the changes in crm _serviceContext.UpdateObject(repcodeMember); _serviceContext.SaveChanges(); // --- The timeout error happens here </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload