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

Get Sales Shipment Header during Invoice posting

(0) ShareShare
ReportReport
Posted on by 3,013

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?

I have the same question (0)
  • Suggested answer
    Ghetz Profile Picture
    3,013 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
    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

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 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans