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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Created Pending Invoice Through X++, Cannot be Displayed "One or more invoices are in use"

(1) ShareShare
ReportReport
Posted on by 1,036
Hi dear community!
 
I'm facing this issue where I'm unable to display the pending invoice created through x++ until I click on "Recover invoice" on the prompt form that appears when I click on "Edit" on the pending invoice.
 
I have a .NET application that can generate a pending invoice in D365 by using a custom service.
I have a custom D365 service that will create the pending invoice by filling VendInvoiceInfoTable, VendInvoiceInfoLine tables and using PurchFormLetterInvoiceContract, PurchFormletterParmDataInvoice classes.
 
I can see the invoice listed in the "Vendor Pending Invoices" screen, but when I click on "Edit", a side form will pop up saying "One or more invoices are in use".
Please look at the following screenshot:
 
I can only access the invoice once, I click on "Recover invoices".
 
What am I missing here?
Are there records causing this issue that needs to be deleted after creating the pending invoice?
I'm not sure how this pop up form is doing the validation to consider this pending invoice as being in use.
Also I'm not sure what this Recover invoices button does actually.
 
I hope you can enlighten me what is causing this error and how does this pop form work (how it validate and what the recover invoices button do).
 
Any advice is appreciated !
 
Thanks in advance !
I have the same question (0)
  • Raj Borad Profile Picture
    1,428 on at

    Hi,

    An invoice may become locked when creating a pending invoice, as the system prevents simultaneous edits by multiple users. Typically, this lock is released when the user completes their work by saving or closing the form.

    However, in cases of improper session management, such as incomplete transactions or exceptions during the process in .Net application and D365 Service, the lock might not be released properly, causing the system to think the invoice is still being edited.

    The "Recover Invoice" button allows you to forcefully release any existing locks, which is useful if the lock wasn’t properly released during the previous session or transaction.

  • Momochi Profile Picture
    1,036 on at
    Hi dear @Raj Borad,
     
    Thanks for the explanation. 
     
    Is this lock a value in a table that maybe I can add the logic to remove this lock after creating the pending invoice in the custom service?
  • RD-27080755-0 Profile Picture
    2 on at
    Hi,

    I have the same problem. How to simulate the recover in X++ to avoid the form "One or more invoices are in use"

    Thanks in advance !
  • Raj Borad Profile Picture
    1,428 on at
    Hi,
     
    The unlocking of the Journal is done by an administrator of the system who has analyzed any executing batch jobs and confirmed this Journal is no longer actively being processed by a batch job.
    So, I think the unlocking of the Journal cannot be done using the code.
     
    Try to debug code while hit the button available on the journal page to unlock a journal that has a status of "locked by system" set to Yes.
     
    Thank you,
    Raj D Borad
  • Suggested answer
    Sufian.Ahmad Profile Picture
    6 on at
    Hi,
    When user clicks on "Number" field on pending vendor invoice. System will check if that invoice is active (under use by other online user) or not. If it is active then invoice recovery form will be opened (Class: PurchFormletterParmDataInvoice, Method: getActiveList). To avoid this follow these steps.
     
    1. When your custom D365 service is completed the invoice creation process, execute select statement on PurchParmUpdate and remove relevant record from this table (Relation between VendInvoiceInfoTable and PurchParmTable is based ParmId).
    2. Execute update statement on VendInvoiceInfoTable and clear ParmId field value from table.
     
     
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans