I have registered a plugin on Entity A of SetStateDynamicEntity, and in this plugin I send email and in code I use calling user as the initiating user.
I have got another plugin which sets the state of Entity A, In this plugin I have correct initiating user, however this in SetStateDyamicEntity when I try to send email, initiating user is changed to SystemUser, and hence when email is sent following email error is thrown. as "System" User account does not have email address hence no approved user to send email.
The Web Service plug-in failed in
OrganizationId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;
SdkMessageProcessingStepId: 05cdbb1b-ea3e-db11-86a7-000a3a5473e8; EntityName:
email; Stage: 30; MessageName: Send; AssemblyName:
Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel,
Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName:
Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled
Exception: System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation.
at
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object
target, Object[] arguments, SignatureStruct& sig, MethodAttributes
methodAttributes, RuntimeType typeOwner)
at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture, Boolean
skipVisibilityChecks)
at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)
at
System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[]
values)
at
Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider
serviceProvider)
at
Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext
context)
Inner Exception:
System.Runtime.Serialization.SerializationException: Type
'System.Collections.Generic.List`1[[System.Guid, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name
'ArrayOfguid:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not
expected. Consider using a DataContractResolver or add any types not known
statically to the list of known types - for example, by using the
KnownTypeAttribute attribute or by adding them to the list of known types
passed to DataContractSerializer.
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean
verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator
xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType,
Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
WriteKeyValuePairOfstringanyTypeToXml(XmlWriterDelegator , Object ,
XmlObjectSerializerWriteContext , ClassDataContract )
at
System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
WriteParameterCollectionToXml(XmlWriterDelegator , Object ,
XmlObjectSerializerWriteContext , CollectionDataContract )
at
System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle
declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteAsyncOperationDataToXml(XmlWriterDelegator
, Object , XmlObjectSerializerWriteContext , ClassDataContract )
at
System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle
declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
WriteAsyncOperationDataToXml(XmlWriterDelegator , Object ,
XmlObjectSerializerWriteContext , ClassDataContract )
at
System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle
declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
WriteAsyncOperationDataToXml(XmlWriterDelegator , Object ,
XmlObjectSerializerWriteContext , ClassDataContract )
at
System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle
declaredTypeHandle)
at
System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator
writer, Object graph, DataContractResolver dataContractResolver)
at
System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator
writer, Object graph, DataContractResolver dataContractResolver)
at
System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator
writer, Object graph, DataContractResolver dataContractResolver)
at
System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter
writer, Object graph)
at
Microsoft.Crm.Extensibility.AsynchronousStep.SerializeAsyncData(PipelineExecutionContext
context)
at Microsoft.Crm.Extensibility.AsynchronousStep.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.SystemUserProxy.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at
Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext
pluginContext)
at
Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity
entity, FilterExpression filter, Int32 invocationSource, ExecutionContext
context)
at
Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.Update(BusinessEntity
entity, FilterExpression filter, ExecutionContext context)
at
Microsoft.Crm.BusinessEntities.BusinessProcessObject.UpdateWithPipelineAndExtensions(IBusinessEntity
entity, ExecutionContext context)
at
Microsoft.Crm.ObjectModel.GenericActivityServiceBase.UpdateInternal(IBusinessEntity
entityInterface, ExecutionContext context)
at
Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.Update(IBusinessEntity
entityInterface, ExecutionContext context)
at
Microsoft.Crm.ObjectModel.EmailService.UpdateHelper(IBusinessEntity
entityInterface, ExecutionContext context, Boolean internalUpdateCall)
at
Microsoft.Crm.ObjectModel.EmailService.Send(Guid emailId, Boolean issueSend,
String trackingToken, ExecutionContext context)
Resolution: In the plugin due to which SetStateDynamicEntity plugin is firing, use sharedvariable, and set the intiating user in shared variable and in SetStateDynamicEntity get the actual initiating user from SharedVairable, and use it as calling user.
No comments:
Post a Comment