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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Duplicate sales invoices

(0) ShareShare
ReportReport
Posted on by 10

Hello,

We are interfacing to an external application that feeds our AX 2012 R3 system sales orders and invoices.  We have found that the system allows some customer to get the same invoice number multiple times.  I can see that AX allows that since the custTrans table does not use a unique key on the customer number invoice combination, but I'm concerned about other possible issues.  Are there other problems that could come up from allowing duplicate AR customer and invoice number combinations?

Thanks,

Shawn

*This post is locked for comments

I have the same question (0)
  • ShawnT Profile Picture
    10 on at
    RE: Duplicate sales invoices

    Please don't spend your time on checking this.  You've answered plenty of questions already.  I am looking in our test environment and see that CustInvoiceJour also has the RecId as part of the unique key, so that may be why we haven't had any issues with it yet.  I will put through some test invoices in Test to see what happens.

    Thanks again for all you input.

  • Verified answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: Duplicate sales invoices

    Customer is not part of the unique index on CustInvoiceJour.  That doesn't mean that there aren't some other code constraints elsewhere to prevent certain types of posting.  I can confirm that the same Invoice number can occur different Invoice dates, because I've seen it happen.  Since we put a stop to it quickly, I doubt any had the same customer, but I can check easily enough.

    Really, it would pretty easy to arrive at answers through testing in test environment.  Much easier than trying to trace the code.

  • ShawnT Profile Picture
    10 on at
    RE: Duplicate sales invoices

    I am actually trying to work with IT to have AX generate the invoice numbers.  They have told me the unique combination is the customer, invoice number and date.  There could be the same invoice number for the same customer multiple times, but not on the same date.

    They wanted to have sales orders generated to handle inventory use and both systems use the same item numbers.  They haven't told me about numbersequenceGroup being setup per customer.  Would the combination of customer number, invoice date and invoice number be unique enough for CustInvoiceJour?

    I appreciate your responses and insight.  I want to make sure we're not creating a mess here.

    Regards,

    Shawn

  • Brandon Wiese Profile Picture
    17,788 on at
    RE: Duplicate sales invoices

    It does not include the customer, but that's what NumberSequenceGroup represents.  You can assign a NumberSequenceGroup to a customer or customers, and that copies to Sales orders, and then to the CustInvoiceJour record itself.  It specifically allows different customers to have their own Number sequence, which of course must support using the same Invoice number (since most sequences start at 1).

    I have never imported invoices from an external system using Sales orders.  If you're looking for effects in Inventory and the Item numbers are the same between the two systems, it seems plausible.

    I still think it's a bad idea to duplicate the same Invoice number across customers and especially within the same customer, but you seem intent on doing it and apparently have been already.  You may still have the issue of the same InvoiceId for the same NumberSequenceGroup on the same InvoiceDate, then you will simply be screwed.

  • ShawnT Profile Picture
    10 on at
    RE: Duplicate sales invoices

    Brandon,

    These are coming in as sales orders and being automatically invoiced when they come into AX.  It uses the invoice number that is passed in on the interface.  You mentioned the primary key of the CustInvoiceJour has InvoiceId, InvoiceDate and NumberSequenceGroup.  Does it not include the customer account number?  I ask because the invoice number could be used multiple times for the same customer.

    What kind of problems exist for bringing these in this way?

    Regards,

    Shawn

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: Duplicate sales invoices

    Beyond that, you could run into other issues depending on how you load the invoices.  If you choose Free text invoice to load the external invoices, you will run into warnings and such trying to load the same InvoiceId twice.  The General journal approach (using account type Customer and specifying an Invoice number), tends to be more flexible.  There are some additional considerations.  For example, if you create a General journal voucher with many offset lines, each representing one of the invoice lines in the remote system, upon posting you will end up with a single CustInvoiceTrans record under the CustInvoiceJour record, so you will lose detail after the posting (the amount will still be correct of course).  Free text invoice faithfully creates one CustInvoiceTrans record per line.  This is just one example.

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: Duplicate sales invoices

    We have this same problem.

    The primary key on the CustInvoiceJour table is InvoiceId, InvoiceDate, and NumberSequenceGroup, which means technically it's allowed to use the same InvoiceId on different dates, but it's theoretically possible to use the same InvoiceId on the same date across two different NumberSequenceGroups, though I've never seen anyone actually do that.

    But beyond being possible, it tends to not be a good idea.  Even if you can convince auditors to accept it (and auditors are notorious for being fine with something this year, and really kicking back in some future year on the same issue), it can be confusing to your A/R team, and even to customers (over whom you have much less control and often cannot just say "figure it out").  Eventually you will run across the same InvoiceId on two different dates that have the identical invoice amount, and good luck collecting payment on both of those.

    Beyond what the system will let you do, it's a matter of expectations.  People expect InvoiceId to be unique for all invoices, and systems that fail to meet this expectation often leave people grinding their teeth in aggravation and disappointment.

    We no longer support the same InvoiceId more than once.  Whenever a remote system collides with its own invoice numbers, we force them to fix it.  In cases where they cannot, we add a "-1" manually on the import, which is a pain.  But, the solution is less work overall than just letting them in "as is".

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: Duplicate sales invoices

    Hello Shawn, I am not aware of any process that might be completely interrupted because of this duplicate invoice number issue. You might, however, get the one or the other warning message that the number has been used before. It will be interesting to hear the opinion of some other community members to see whether they might see some absolute "no-go" reasons for this kind of invoice processing. All the best, Ludwig

  • ShawnT Profile Picture
    10 on at
    RE: Duplicate sales invoices

    Hello Ludwig,

    We have been using the external system for a little while now and I assume the auditors are on board with it (shouldn't assume but they wouldn't tell me anyway).

    Is there anything that could hurt the functionality in AX?  I guess my biggest concern is that these come in and have some unintended affects on the system.

    Thanks you for your reply.

    Shawn

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: Duplicate sales invoices

    Hi Shawn, from a non-technical accounting perspective you could get into trouble with the company's auditors and the tax office. I would this suggest that you change the way of importing and processing invoices. Best regards, Ludwig

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans