Hello, I've created an extension that adds an additional field in the Sales Order table & page (called Document Revision Number). But we have noticed that when we archive the sales order, it moves to a new table (Sales Order Archive) which does not have that field, so the information is lost. I need to figure out how to have it keep that field when it moves to the archive. The two things I need do are:
The problem is, the only thing I've found online is about events. I haven't been able to figure out how to create an event subscriber that would accomplish this. Any advice is appreciated.
For the all old records which dont have that field you can go with Vaishnavi suggestion but for every new records you can create the same field with same ID in Sales header and Sales Archive Header table. so that I will transferred automatically when you will do the archive.
Hi, Vaishnavi gave good examples, you can also look for clues yourself in codeunit 5063 ArchiveManagement.
For example, this is the event used by Vaishnavi.
Also, although I haven't tried it, the event below should work as well.
Hope this helps.
Thanks.
ZHU
Vaishnavi gave you the answer...make the field number is sales header and sales header archive and BC takes care of the rest!
Hi,
Create a field in Sales Order Archive table and display it on page.
Please note if the Field No in Sales Order table and Sales Order Archive table is same then you don't need to add the below logic the code unit part.
Generally Microsoft uses Transferfield function when transferring the data in two different tables if the Field No. is same then transferfield function will set the data in Archive Table.
if the Field No. are different in both the tables then you have to write the below logic .
codeunit 50044 Events
If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much
Sohail Ahmed
2,655
Mansi Soni
1,574
YUN ZHU
1,453
Super User 2025 Season 1