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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Programmatically assign Invoice Number while Posting from Sales Order

(2) ShareShare
ReportReport
Posted on by 4,014
When we post Sales Invoice from Sales Order in BC, the Invoice number is assigned based on No. Series. Is it possible to programmatically assign manual Invoice Number? For example, when user Post Invoice, the Invoice Number would be based on Customer PO Number in Sales Order with a Prefix, such as "INV-<Customer PO>"
Thank you.
 
 
 
I have the same question (0)
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,547 Super User 2026 Season 1 on at
    I don't think its possible in standard Business Central but would be done using custom code. But why do you need to Customer PO in invoice. You can create custom flow field to track the customer POs
     
    Thanks!
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Gerardo Rentería García Profile Picture
    25,555 Most Valuable Professional on at
  • Suggested answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at
    This needs to be customized, or you need to enter it manually each time. Hopefully the following information can give you some hints
    Dynamics 365 Business Central: Manual number for Posted Sales invoice and Posted Purchase invoice (Use the same number in Sales Order and Posted Sales Invoice?)
    Thanks.
    ZHU
  • Suggested answer
    Mansi Soni Profile Picture
    8,951 Super User 2026 Season 1 on at
    Hello,

    Yes, it is possible to assign a custom invoice number like "INV-" when posting a Sales Invoice from a Sales Order in Business Central, but it requires customization. By default, the system uses the No. Series for invoice numbering, and overriding this behavior programmatically involves customizing the posting routine to fetch the Customer PO number and assign it as the invoice number with a prefix. This must be done carefully to ensure uniqueness and maintain data integrity.

    Hope this answer will help you!

    Regards,
    Mansi Soni
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,169 Super User 2026 Season 1 on at
     
    In standard Business Central, the invoice number is strictly controlled by the No. Series defined in the Sales & Receivables Setup and assigned on the Sales Header. Business Central does not support manual invoice numbering during posting due to audit trail and data integrity constraints.
     
    However, to achieve what you're asking — assigning the invoice number programmatically based on the Customer PO No. — you'd need to:
     
    1. Create a customization in AL.
     
     
    2. Use the OnBeforeInsertSalesInvoiceHeader event in the Codeunit 80 "Sales-Post" to override the No. field before the invoice is created.
     
     
    3. Validate that the number you assign does not conflict with existing entries and aligns with any required number series settings.
     
     
     
    Keep in mind:
     
    You might face restrictions when trying to bypass the No. Series enforcement.
     
    Doing this can break future posting and integration logic (like e-invoicing or audit expectations).
     
    A safer alternative is to keep the standard number, but include the Customer PO No. prominently in the external document number or description field on the invoice.
     
     
    ✅ Mark this answer as verified if it helps you.
     
     
  • Suggested answer
    RockwithNav Profile Picture
    8,941 Super User 2026 Season 1 on at
    There's a column which says Posting No on the Order, enable this and put it on the order screen, whatever value you will feed in this that will be used as Posted Invoice No.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans