web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Plugin call Action Error "New transaction is not allowed because there are other threads running in the session"

(0) ShareShare
ReportReport
Posted on by 91

Hi,

I have Dynamics 365 V8.2 on-premise and I have sometimes an error "New transaction is not allowed because there are other threads running in the session" inside an asyn plugin when its calling an action.

1. I have an custom action based on account entity which will call SAP api to send crm account info to SAP

2. I have an async plugin trigged by updating a custom entity and then, it will update the a field on account entity and then call action in step 1 to send updated account infomation to sap. but sometimes , this plugin failed to execute with an error "New transaction is not allowed because there are other threads running in the session", and this error was threw when calling the action. it is very strange for me. this problem happened serveral times daily, abount 15%-30%.

3. I have a workflow which call the action in step 1, when the pluign failed to send info to sap, I will run this workflow manually and this workflows always works well, without any error.

I have searched a lot and this error and I can not found any useful information. I have also add 3 times retry today but it does has 3 times failed with the same error.

Thank you.

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    There are a couple of things to check in your code:

    Do you use the IOrganizationService instance that is derived from the IPluginExecutionContext for all calls to CRM ? If you use a different method to access CRM in your plugin, you could cause issues as this would be considered a new connection and new transaction. If possible, you should always use the IOrganizationService instance that is derived from the IPluginExecutionContext.

    Do you make any calls to access or modify metadata in the plugin ? Metadata operations, especially when modifying metadata, run under a different SQL concurrency level, and this can cause issues. However, you normally get a different error in this scenario

  • Song Profile Picture
    91 on at

    Hi David,

    Maybe your first point explains my problem. I found that I have put a static IOrganizationService outside the Execute Method.

    I should put the instance of IOrganizationService inside the Execute  method and pass as an parameter to another method. Am I right?

    Thank you and I will try it.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans