Fix for Invoice Posting Locks in Dynamics 365

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

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:

  • Every time multiple users are posting purchase orders (existing or newly created) there is a field called the SourceDocumentLine that’s updated on the CustInvoiceLine table or the SourceDocumentHeader that’s updated on the CustInvoiceTable.
  • The field will not update when the General Ledger parameter ‘Process source document lines in parallel’ is set to ‘Yes’ (as happened in this case initially).

Purchase Invoices:

  • Every time multiple users are posting purchase invoices (existing or newly created) there is a field called the SourceDocumentLine that’s updated on the VendInvoiceInfoLine or the SourceDocumentHeader on the VendInvoiceInfoTable.
  • The field will not update when the above mentioned General Ledger parameter ‘Process source document lines in parallel’ is set to ‘Yes.’

Fig 2 – Process source document lines in parallel

References:

Disclaimer: The Questions and Answers provided on https://www.gigxp.com are for general information purposes only. We make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose.

Navneeth Nagrajan is a Technical Consultant at Avanade Australia focusing on implementation, pre-sales and support of Microsoft Dynamics 365 for Operations/ Microsoft Dynamics Ax ERP. Before Avanade, Navneeth worked as a Solutions Consultant at LM WindPower focusing on implementation and support of Microsoft Dynamics Ax Enterprise Resource Planning solution. Prior to LM WindPower, he worked as a Lead Consultant for ITC Infotech India Limited focusing on Enterprise Solutions like Microsoft Dynamics AX & Microsoft Dynamics CRM. He has worked for Microsoft as a Partner Technical Consultant. His primary focus area is Microsoft Dynamics AX and he specializes on Trade & Logistics, CRM, Service Management and Project Management functionalities. His secondary focus area is Microsoft Dynamics CRM and he specializes on Sales Management, Marketing Management and Service Management sections. He has successfully assisted more than 100 Microsoft partners and customers. At Microsoft, He has successfully written and published papers on '​'​ Needs for Microsoft Dynamics CRM in the Education Sector''. Prior to Microsoft, he has worked as a Functional Consultant and has implemented Microsoft Dynamics AX in the Manufacturing and Services Segment. He has also worked as a Business Development Executive implementing Document Management Systems for Security Broking and Manufacturing Organizations.