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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Assistance Required to Resolve Deadlock Issue in Webservice API

(1) ShareShare
ReportReport
Posted on by 244
Hi Techis,
 
I am currently working with a Webservice API (BC OnPrem) that inserts lines into Payment Journal Pages. However, when the volume exceeds 100 lines, I encounter the following error:
 
“The activity was deadlocked with another user who was modifying the Gen. Journal Line table. Please retry the activity.”
 
Could you please help me with the following:
 
1. Is there a way to identify which users or processes are causing the table lock?
2. What steps can be taken to resolve or avoid the deadlock issue?
 
Looking forward to your guidance.
 
Regards
Raj
I have the same question (0)
  • xgaronnat Profile Picture
    40 on at
    Hello Rajaneesh,
    You should have a look to batch / error handling with API : https://www.kauffmann.nl/2020/12/22/batch-calls-with-business-central-2-error-handling/
     
     
  • Suggested answer
    Ramiz Profile Picture
    597 on at
    Hi,

    Try this PowerBI reports or telemetry to see in depth details. It requires PowerBI pro license but you can use a trial for 60 days.

    https://appsource.microsoft.com/en-us/product/power-bi/microsoftdynsmb.bc_telemetry_pbi_app

    Also, how are you consuming the API? I have inserted 100+ records in General Jounral Line using API and never faced this error.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,206 Super User 2026 Season 1 on at
  • Alexander Drogin Profile Picture
    262 on at
    There are no tools in Business Central that could point to a specific user session that intervenes with the insert. But on the other hand, it's a good thing that you are dealing with an on-prem environment rather than SaaS, it's always easier to troubleshoot when it comes to locking problems. Best way to start is to capture SQL events with the SQL Server Profiler while your web service client is active. Enable capturing the Deadlock Graph event in the profiler: Analyze Deadlocks - SQL Server Profiler | Microsoft Learn 
    This event will show you exact SQL queries that were deadlocked, and from there you can figure out the code causes the lock.
    Only when you have the first answer you can start taking measures to prevent the deadlock, because reasons can vary widely and the respective steps can be very different.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,947 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,120 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 628 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans