After applying Update Rollup 10, 11, 12 or 13 to Microsoft Dynamics CRM, you may see an issue where workflows that contain a step to send an email get stuck in a status of waiting. This specific issue occurs if the EnableRetrieveMultipleOptimization key exists in the registry and has a value of 2.
(As a side note, if you have workflows that are stuck in waiting and these conditions are NOT true, then we invite you to refer to another one of PowerObjects blogs, How to Fix a CRM Workflow Stuck In Progress.)
But let’s return to the original issue. We saw that system jobs for all workflows that included a step to send emails were stuck with a status of “Waiting,” but all other workflows were succeeding, so we were quickly able to rule out an Async Service issue.
If you have this problem, you can see the error by opening a system job of one of the workflows with a status of waiting, then expanding the details. This is the message:
Crm Exception: Message: Attribute objecttypecode on Entity PrincipalObjectAccessReadSnapshot is of type picklist but has Child Attributes Count 0, ErrorCode: -2147220912
We noticed this error was present on multiple workflows and organizations. However, the error message is not enough to isolate the cause of the error.
At this point, a CRM Platform Trace is a great tool for revealing what is occurring at the platform layer in CRM, while triggering one of the problem workflows to run.
The key to identifying this issue was the exception in the CRM platform trace:
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException) ilOffset = 0x0
at CrmException..ctor(String message, Int32 errorCode) ilOffset = 0x0
at PagingHelper.GetPagingFieldValue(AttributeMetadata attribute) ilOffset = 0xA6
at PagingHelper.Serialize(OrderExpressionCollection orderCollection, BusinessEntityCollection entities, EntityExpression entityExpression, ExecutionContext context) ilOffset = 0xF6
at PagingHelper.CreatePagingCookie(BusinessEntityCollection entities, EntityExpression entityExpression, ExecutionContext context) ilOffset = 0x36
at Business.QueryAndFillEntityCollection(CrmDbConnection dbConnection, IDbCommand dbCommand, BusinessEntityCollection entities, EntityExpression entityExp, PagingHelper pagingHelper, Boolean useEntityExpression, String aggregateLimitExceededName, ExecutionContext context) ilOffset = 0x6A
at Business.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, PagingHelper pagingHelper, ExecutionContext context) ilOffset = 0x41
at Business.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, ExecutionContext context) ilOffset = 0x40
The “GetPagingFieldValue” would only appear if the EnableRetrieveMultipleOptimization was present with a value of 2. Since the CRM Server was on UR 12, the EnableRetrieveMultipleOptimization was no longer needed. The logic for optimizing the performance for queries which run against large sets of data changed with Update Rollup 10. In other words, the old logic was causing the issue with workflows.
The resolution to this issue is to delete the EnableRetrieveMultipleOptimization registry key and restart all the CRM services. Voila! That’s it.
Hope this helps. If you’re looking for additional technical support from PowerObjects, don’t hesitate to contact us.