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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Migrate Sales Order Before Posting

(0) ShareShare
ReportReport
Posted on by 260

Greetings to all of you.

The case: 

I need , when a sales order is invoiced in the COMPANY A, this sales order, before it gets deleted and become archive sales order, to be migrated in Company B. ( as an open sales order).

I basically try to find an event which runs after posting but before deleting the sales order and transforming it to the archive one (at this moment i dont care about the posted document,only for the sales order just before it gets deleted after posting action).

Does anyone know any useful event to subscribe on?

With respect,

Antonis

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,248 Super User 2026 Season 2 on at

    You can use OnBeforeDeleteAfterPosting event from Codeunit 80 "Sales-Post"

    local procedure OnBeforeDeleteAfterPosting(var SalesHeader: Record "Sales Header"; var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var SkipDelete: Boolean; CommitIsSuppressed: Boolean; EverythingInvoiced: Boolean; var TempSalesLineGlobal: Record "Sales Line" temporary)

       begin

       end;

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You can try below Event in Codeunit 80

    OnBeforeHandleArchiveUnpostedOrder

  • AntonisK Profile Picture
    260 on at

    Great answer fellow friend!

    I was using a similar event to what you proposed, but your event is even better , so it did the job perfectly.

    Thanks a lot

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 July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 607 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 421 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 375 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans