3
Vote

Getting System.ServiceModel.FaultException

description

For some of the records i'm getting following two errors in OOB workflow where we are using Distributed workflow assembly.

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: System.ServiceModel.FaultException 1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: ValidateOpen - Encountered disposed CrmDbConnection when it should not be disposed (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
at Gemina.CRM2011.WF.CrmDistributeWF.CodeActivityBase.Execute(CodeActivityContext executionContext)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: System.ServiceModel.FaultException 1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: VerifyCommitted - Transaction has not been committed (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
at Gemina.CRM2011.WF.CrmDistributeWF.CodeActivityBase.Execute(CodeActivityContext executionContext)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

comments

zhaparoff wrote Aug 1, 2013 at 4:04 PM

Hello!

This error happens when this workflow step is run on several records of one type simultaneously.
This situation arises from use of class-level variables in CodeActivityBase class.

CRM's workflow engine does not generate separate CodeActivity class instances for different records in one workflow processing cycle. Therefore, engine uses one instance of this class, but with different executionContext values.

So I've customized code activity classes to use only in-method variables, or variables passed as params (such as executionContext).
All you need to do:
  1. Remove variables CurrentRecordId, CurrentEntityName and CurrentOperation from CodeActivityBase class.
  2. Fix DistributeWFActivityManytoMany and DistributeWFActivityOnetoMany classes to get this variables through executionContext in their methods.
The problem now is gone for me.

ah_burgwal wrote Jan 14, 2014 at 12:47 PM

Hi,

I use this tool a lot and recently ran into the same erros as described here. However I'm not a software engineer and therefore don't know how to customize the code. Is there a possibility to release these changes in a managed solution?

Thanks,
André

robdriessen wrote Feb 4, 2014 at 10:42 AM

Hi,

same for me, I use it a lot and am also getting this problems, so please, a managed solution ?

wrote Apr 8, 2014 at 5:11 PM

joexrmguy wrote Apr 8, 2014 at 9:19 PM

This is resolved in Gap Consulting's version which features debugging entities. Make sure your users have read and create permission to the interface entities included in the solution. Look for Our Solutions > Free Tools > Workflow Essentials.

DSarafov wrote Jul 29, 2014 at 8:11 AM

Hallo

I had errors like this and solutions for my problem was very simple. I don't have enough free space for more records. Try it may be this is part of your problem.

Good luck