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...
Answered

Get Sales Shipment Header during Invoice posting

(0) ShareShare
ReportReport
Posted on by 3,029

When posting an Sales invoice, is there any way we can get the Sales Shipment No. ? We have created a custom field in "Sales invoice header", "Shipment No.";

When a user posts a sales Order with "Ship and invoice" option, we want to save the shipment number in this new field. The problem is, I can't find an event where I have the Shipment No. available.

My idea was to use the OnBeforeSalesInvHeaderInsert Event in CU 80, but I don't have the Shipment No. here.

LOCAL [EventSubscriber] OnBeforeSalesInvHeaderInsert(VAR SalesInvHeader : Record "Sales Invoice Header";SalesHeader : Record "Sales Header";CommitIsSuppressed : Boolean) 

Any ideas?

  • Suggested answer
    Ghetz Profile Picture
    3,029 on at

    OK. In case it helps someone, I finally used a different trigger from CU80

    LOCAL [EventSubscriber] OnAfterPostSalesLines(VAR SalesHeader : Record "Sales Header";VAR SalesShipmentHeader : Record "Sales Shipment Header";VAR SalesInvoiceHeader : Record "Sales Invoice Header";VAR SalesCrMemoHeader : Record "Sales Cr.Memo Header";VAR ReturnReceiptHeader : Record "Return Receipt Header";WhseShip : Boolean;WhseReceive : Boolean;VAR SalesLinesProcessed : Boolean;CommitIsSuppressed : Boolean;EverythingInvoiced : Boolean)

    IF SalesHeader.Ship THEN

     SalesInvoiceHeader."Custom Field" := SalesShipmentHeader."No.";

     SalesInvoiceHeader.MODIFY;
  • Andy Sather Profile Picture
    Microsoft Employee on at

    Thank you for posting your solution

  • Anita75 Profile Picture
    1,165 on at

    thanks but Didn't work in 17.2 version and got this error though using "SUPER" permission set:

    You do not have the following permissions on TableData Sales Invoice Header: Modify.

    Logically you cannot modify posted invoice?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 755 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 413 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 387 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans