Gig XP

Fix for Invoice Posting Locks in Dynamics 365 for Finance and Operations

Fix for Invoice Posting Locks in Dynamics 365

One of the common issues that we face in a User Acceptance Testing (UAT) session is the database locks on invoice posting tables.

Issue:

When multiple users log in and are posting free text invoices or purchase invoices, the database was locking and preventing the invoices from being displayed.

Fix: (Invoice Posting Locks in Dynamics 365)

In General Ledger, there is a parameter under the section Source Document called Process source document lines in parallel. This should be set to ‘No’ instead of setting it to ‘Yes.’

How to check the invoice posting locking issues:

While posting a free text invoice, sales invoice or a purchase invoice, if the Dynamics 365 for Finance and Operations takes a while (ideally more than a minute to post an invoice), then choose the environment where we are monitoring the processing of invoices (i.e., UAT in this case) and choose SQL Insights -> Live View -> Currently Executing Statements.
In the Currently executing statements section, you will see a LCK_M_U wait typeset on the tables CustInvoiceInfoLine or CustInvoiceTable (if we are posting sales invoices) and/or on VendInvoiceTable or VendInvoiceInfoTable (if we are posting purchase invoices). 

Fig 1 – Table locks in Lifecycle Services

Technical Reason:

The database locking for invoice posting tables usually occurs when the ‘Process source document lines in parallel’ is set to ‘Yes.’ This setting prevents the update of a specific field called SourceDocumentLine or SourceDocumentHeader on the line or header tables. This update fails when multiple users are logged into Finance and Operations and are trying to post Free Text Invoices or Sales Invoices or Purchase Invoices.
Details of the database fields are given below.

Free Text Invoice/Sales Invoice:

Purchase Invoices:


Fig 2 – Process source document lines in parallel

References: