I've coded for a plugin that throw the OrganizationService Object in the exception to check whether it contains anything for organization or not. But I came across with exception. I'm attaching both in the following and looking forward for your guidance. TIA!!
Code:
protected void ExecutePostRequestforApprovalCreate(LocalPluginContext localContext) { if (localContext == null) { throw new ArgumentNullException("localContext"); } IPluginExecutionContext context = localContext.PluginExecutionContext; IOrganizationService service = localContext.OrganizationService; var serviceContext = new OrganizationServiceContext(service); throw new ArgumentException("Exception sent:"+service.ToString()); }
Exception:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null. Parameter name: The plug-in type could not be found in the plug-in assembly: approveCheckListTest.Plugins.PostRequestforApprovalCreateDetail: <OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts"> <ErrorCode>-2147220970</ErrorCode> <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic"> <KeyValuePairOfstringanyType> <d2p1:key>CallStack</d2p1:key> <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string"> at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal() at Microsoft.Crm.Application.Platform.ServiceCommands.CreateCommand.Execute() at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId) at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck) at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)</d2p1:value> </KeyValuePairOfstringanyType> </ErrorDetails> <Message>System.ArgumentNullException: Value cannot be null. Parameter name: The plug-in type could not be found in the plug-in assembly: approveCheckListTest.Plugins.PostRequestforApprovalCreate</Message> <Timestamp>2015-08-04T08:32:19.3215616Z</Timestamp> <InnerFault i:nil="true" /> <TraceText> [approveCheckListTest.Plugins: approveCheckListTest.Plugins.PostRequestforApprovalCreate] [613491a3-813a-e511-800b-005056b743f7: PostRequestforApprovalCreate] </TraceText> </OrganizationServiceFault>