Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Migrate Sales Order Before Posting

Posted on by 171

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

  • AntonisK Profile Picture
    AntonisK 171 on at
    RE: Migrate Sales Order Before Posting

    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

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Migrate Sales Order Before Posting

    Hi,

    You can try below Event in Codeunit 80

    OnBeforeHandleArchiveUnpostedOrder

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,133 Super User 2024 Season 2 on at
    RE: Migrate Sales Order Before Posting

    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;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans