Hello,

We are using dynamics 365 onprem and there are several erros being logged in event viewer from source MSCRMAsyncService.

Basically we are creating email activities with a plugin, but several emails got stuck at "pending send".

Any idea what is going on?

This is what the log shows:

Host JobId: 21ef97db-7336-ec11-a842-005056a949ac OrgId:c663d37a-40b2-eb11-a852-005056a979d4 JobType:10; ErrorMessage:Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: email With Id = 72d07bd2-7336-ec11-a851-a0713caf1036 Does Not ExistDetail:
<OrganizationServiceFault xmlns:i="">www.w3.org/.../XMLSchema-instance" xmlns="">schemas.microsoft.com/.../Contracts">
<ActivityId>d9468748-9e5c-4257-b5b7-05ed03d000eb</ActivityId>
<ErrorCode>-2147220969</ErrorCode>
<ErrorDetails xmlns:d2p1="">schemas.datacontract.org/.../System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>ApiExceptionSourceKey</d2p1:key>
<d2p1:value xmlns:d4p1="">www.w3.org/.../XMLSchema" i:type="d4p1:string">Plugin/Microsoft.Crm.Common.ObjectModel.EmailService</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiOriginalExceptionKey</d2p1:key>
<d2p1:value xmlns:d4p1="">www.w3.org/.../XMLSchema" i:type="d4p1:string">Microsoft.Crm.BusinessEntities.CrmObjectNotFoundException: email With Id = 72d07bd2-7336-ec11-a851-a0713caf1036 Does Not Exist ---&gt; Microsoft.Crm.BusinessEntities.CrmObjectNotFoundException: email With Id = 72d07bd2-7336-ec11-a851-a0713caf1036 Does Not Exist
at Microsoft.Crm.Common.ObjectModel.EmailService.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
--- End of inner exception stack trace ---
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass2_1.&lt;Execute&gt;b__0()</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiStepKey</d2p1:key>
<d2p1:value xmlns:d4p1="">schemas.microsoft.com/.../" i:type="d4p1:guid">a3cbbb1b-ea3e-db11-86a7-000a3a5473e8</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiDepthKey</d2p1:key>
<d2p1:value xmlns:d4p1="
">www.w3.org/.../XMLSchema" i:type="d4p1:int">5</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiActivityIdKey</d2p1:key>
<d2p1:value xmlns:d4p1="">schemas.microsoft.com/.../" i:type="d4p1:guid">d9468748-9e5c-4257-b5b7-05ed03d000eb</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiPluginSolutionNameKey</d2p1:key>
<d2p1:value xmlns:d4p1="
">www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiStepSolutionNameKey</d2p1:key>
<d2p1:value xmlns:d4p1="">www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>email With Id = 72d07bd2-7336-ec11-a851-a0713caf1036 Does Not Exist</Message>
<Timestamp>2021-10-26T15:46:22.1893464Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>d9468748-9e5c-4257-b5b7-05ed03d000eb</ActivityId>
<ErrorCode>-2147220969</ErrorCode>
<ErrorDetails xmlns:d3p1="">schemas.datacontract.org/.../System.Collections.Generic" />
<Message>email With Id = 72d07bd2-7336-ec11-a851-a0713caf1036 Does Not Exist</Message>
<Timestamp>2021-10-26T15:46:22.1893464Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
at Microsoft.Crm.Workflow.WorkflowContextBase.RetrievePrimaryEntity(EntityDependencyBase entityDependency)
at Microsoft.Crm.Workflow.WorkflowContextBase.RetrieveEntityInstances()
at Microsoft.Crm.Workflow.ActivityHost.StartWorkflowExecution(Activity workflow, ICommonWorkflowContext context)
at Microsoft.Crm.Workflow.ActivityHostBase.StartWorkflow(ICommonWorkflowContext context, Activity preLoadedActivity)
ErrorCode:-2147220969 ResultCode:10 Machine CRM365SERVER: A Microsoft Dynamics CRM Asynchronous Processing Service operation of type %2 has failed
Organization ID: %3
Organization Unique Name: %4
Error code: %5
Error description: %6