In a Visual Studio workflow for SharePoint 2010, if you have a series of complex logic that check various conditions to determine what to do if a task is completed, you may be tempted to put in multiple OnTaskChanged activities with the token tied to the same CreateTask activity. I have recently tried that. The flow of the workflow looks pretty clear and natural visually. It built and deployed successfully and started and executed the steps successfully until it hit the second OnTaskChanged. The Workflow History logged "An error has occurred in
", and the SharePoint log logged this error:
Error in commiting pending workflow batch items: System.ArgumentException:
0x80070057 at Microsoft.SharePoint.Library.SPRequestInternalClass.RegisterEventReceiver(String bstrUrl, String bstrListName, EventReceiverOperation operation, Guid guidId, String bstrName, Guid guidSiteId, Guid guidWebId, Guid guidHostId, Int32 dwHostType, Int32 dwSynchronization, Int32 dwType, Int32 dwSequenceNumber, String bstrRemoteUrl, String bstrAssembly, String bstrClass, Guid solutionId, String bstrData, String bstrFilter, Int32 dwCredential, Guid contextObjectId, Guid contextType, Guid contextEventType, Guid contextId, Guid contextCollectionId) at Microsoft.SharePoint.Library.SPRequest.RegisterEventReceive.....
THe bottomline is, put one OnTaskChanged activity in a While activity. With a couple of IfElse in there, the workflow would look confusing visually, but it would work fine at runtime.
No comments:
Post a Comment