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 :
Small and medium business | Business Central, N...
Answered

How to import sales invoices into Business Central using next available invoice number

(0) ShareShare
ReportReport
Posted on by 57

Hi there,

I would like like to import Sales Invoices into Business Central using a Configuration Package but I want to use the next available invoice number rather than specifying the number on the import file. The reason is because we want the customer to be able to simply compile the invoice header and lines and import without having to check which number is next in the sequence.

In my Sales Invoice numbering series, I have "Default Nos." selected to automatically choose the next number. I do not have Manual Nos. enabled.

pastedimage1636043916000v1.png

In my import file, the sales invoice number is blank for both the header and the sales line records:

pastedimage1636043991211v2.png

pastedimage1636044000328v3.png

My configuration package is set up with Table 36 and 37 and my Excel source file is based on an export of this.

pastedimage1636044057998v4.png

My problem is that when I import, the Sales Invoice gets created but with no detail lines. In viewing other posts, it seems like you always have to link the header to the lines using the invoice number so I am wondering if it is possible to use the next available invoice number for both header and lines if imported at the same time. 

Thanks,

Craig 

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    Maybe you can achieve this if you code a separate codeunit that do the handling for your import. But that will not be very efficient.

    The document no. is part of the primary key in both tables so the system needs a way to know how they are related to each other during your import.

    It would probably be more efficient to make another routine for importing sales invoices than using the configuration package.  Is this a one time import or something that will be used on a regular basis?

  • Craig Day Profile Picture
    57 on at

    Hi NorthW,

    Thanks for your reply. This will be an ongoing requirement so we would like it to be as automated as possible. If you have any advice as to how to use a different routine to achieve this, please let me know. Otherwise, we do have a developer resource who could customize a solution.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    I do think you should have a developer look at this and not use the config. packages for this import.

    Depending on what the source of the sales invoices are they can be imported using either files or and api.

    In BC version 19 there is good support for both xml files, excel files, csv files as a filesource.  With the new Azure blob storage API you can even have your files automatically read from an Azure blob storge. Dataverse can also be an option.  And in your import routine you can use the no.series management tools to pick the next no. from the no.series you want to use either it is setup for this import or use the one you have in your sales setup. It basically comes down to find the best choice for what is the source of your sales invoice import.

  • Verified answer
    Craig Day Profile Picture
    57 on at

    This is great, thank you very much, NorthW. Please consider this one closed.

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans