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 :
Dynamics 365 Community / Blogs / Technical Findings in Dynamics NAV / Sales Invoicing — Posting/A...

Sales Invoicing — Posting/Archiving/Deleting on Microsoft Dynamics NAV

Nareshwar Raju Vaneshwar Profile Picture Nareshwar Raju Vane... 5,596

There was a requirement to archive the Sales Order document when it is completely invoiced and before the deletion.

So I looked into Codeunit 80 which is Sales-Post and Codeunit 5063 which is ArchiveManagement to inspect how the standard archiving/deleting get performed.

It is evident that every time the Sales document is shipped, the document will be archived with versioning upon the Sales & Receivables Setup.

So I called the standard archiving function which is on the Codeunit 5063, on to Table 36 which is Sales Header, on OnDelete() trigger. I was assuming that after completely invoiced, Sales-Post Codeunit will call OnDelete() trigger in order to delete the document.

1

But I was wrong since it does not call the OnDelete(), and deletes the document right after deleting. As seen on image 1a, the system does not call OnDelete(). This perfectly makes sense because the system surely knows that it has completely invoiced the document, hence no need to trigger OnDelete().

But I called OnDelete() of Sales Header table just to check what is the implication. It throws an error from the Sales Line table.

So I had to place the archiving code before the DELETE; code on Sales-Post, so it worked perfectly.

2




This was originally posted here.

Comments

*This post is locked for comments