public static Incident GetCase(XrmServiceContext context, Guid IncidentID)
{
try
{
var incidentQuery = from incident in context.IncidentSet
where
incident.Id == IncidentID
select incident;
if (incidentQuery.ToList().FirstOrDefault() != null && incidentQuery.ToList().Count > 0)
{
return incidentQuery.ToList().FirstOrDefault();
}
return null;
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException("Detail Message:" + ex.Detail.Message + "\nError Details:" + ex.Detail.ErrorDetails + "\nMethod Name:" + "GetCase");
}
}
and error is :
Sync workflow failed with error message - Unhandled Exception: Microsoft.Crm.Workflow.Services.InvalidCustomActivityExecutionException: Detail Message:Detail Message:System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrImmutable()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.ICommunicationObject.Open()
at Microsoft.Crm.Sandbox.SandboxClientBase`1.Open()
at Microsoft.Crm.Sandbox.SandboxClientBase`1.get_Proxy()
at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest, Object sandboxTraceSettingsObj): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #CFA0EB5D
Error Details:Microsoft.Xrm.Sdk.ErrorDetailCollection
Method Name:GetCase
Activity Name:SendStudiesToCustomer