Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error while calling OnBeginRequest on WorkflowTransactionContext.

Posted on by Microsoft Employee

Hello Guys,

I have a few workflows which sends emails to users if certain conditions are met. However, many of the workflows are failing with the following error:

Would this be related to the CRM Async server? I checked the source code and there is no OnBeginRequest methods. 


Error Message:

Unhandled Exception: Microsoft.Crm.CrmException: Error while calling OnBeginRequest on WorkflowTransactionContext.
at Microsoft.Crm.Workflow.Services.UpdateActivityService.Execute(ActivityContext executionContext, UpdateEntity updateEntity)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Inner Exception: System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect)
at System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at Microsoft.Crm.CrmDbConnection.StartTransaction(IsolationLevel il)
at Microsoft.Crm.CrmTransaction.StartTransaction(IsolationLevel isoLevel, Boolean verifyIsolationLevelIfTransactionAlreadyStarted)
at Microsoft.Crm.SqlExecutionContext.OnBeginRequest(Boolean startTransaction, IsolationLevel isoLevel, SolutionOperationContext operationContext, Guid solutionId, String workloadGroup)
at Microsoft.Crm.BusinessEntities.ExecutionContext.OnBeginRequest(Guid userId, Boolean startTransaction, IsolationLevel isolationLevel, ExecutionOperationContext operationContext, CallerOriginToken originToken)
at Microsoft.Crm.Workflow.WorkflowTransactionContext.StartTransaction()
at Microsoft.Crm.Workflow.WorkflowTransactionContext.OnBeginRequest()
at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate)

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while calling OnBeginRequest on WorkflowTransactionContext.

    The issue was resolved by restarting the async server.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while calling OnBeginRequest on WorkflowTransactionContext.

    Did you ever solve this problem?

    I am not a CRM developer myself, but we get this error a lot in the company I am working.

    We do not have email set up in our solution, but we use the async services a lot.

  • Talsim Profile Picture
    Talsim on at
    RE: Error while calling OnBeginRequest on WorkflowTransactionContext.

    Same Issue only with the build-in SLA workflow

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans