Skip to content

Automated Document Archiving using Shadow Prints

The automation of document archiving using Shadowprints is an essential extension function of Document Central. This integrated mechanism enables the automatic archiving of documents following sales transactions without any user interaction.

Detailed Description of Document Archiving with Shadow Prints

Introduction:

The automation of document archiving through Shadowprints is an indispensable part of the Document Central. This mechanism enables the smooth archiving of documents following sales transactions without the need for manual user interaction.

Archiving steps:

The provided code first checks the activation of the Document Central module and the archive status and then performs the automatic archiving of the corresponding document after the sales transaction.

The following code demonstrates an example function:

[EventSubscriber(ObjectType::Codeunit, 80, 'OnAfterPostSalesDoc', '', true, false)]
local procedure OnAfterPostSalesDocCU80(var SalesHeader: Record "Sales Header"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; SalesShptHdrNo: Code[20]; RetRcpHdrNo: Code[20]; SalesInvHdrNo: Code[20]; SalesCrMemoHdrNo: Code[20]; CommitIsSuppressed: Boolean; InvtPickPutaway: Boolean; var CustLedgerEntry: Record "Cust. Ledger Entry"; WhseShip: Boolean; WhseReceiv: Boolean)
var
    LocalRecordSIMDMSModuleSetup: Record "SIM_DMS Module Setup";
    LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
    LocalRecordSalesCrMemoHeader: Record "Sales Cr.Memo Header";
    LocalCodeunitSIMDMSArchiveMgt: Codeunit "SIM_DMS Archive Mgt";
    LocalRecordRef: RecordRef;
begin
    // Überprüfen, ob das Document Central Modul und Archive Status aktiviert ist
    if not LocalRecordSIMDMSModuleSetup.Get() then exit;
    if not LocalRecordSIMDMSModuleSetup."Archive Status" then exit;

    // Archivierung des entsprechenden Dokuments
    if SalesInvHdrNo <> '' then begin
        LocalRecordSalesInvoiceHeader.Get(SalesInvHdrNo);
        LocalRecordRef.GetTable(LocalRecordSalesInvoiceHeader);
        LocalCodeunitSIMDMSArchiveMgt.OnCodeunitPost(LocalRecordRef, false, true);
    end else if SalesCrMemoHdrNo <> '' then begin
        LocalRecordSalesCrMemoHeader.Get(SalesCrMemoHdrNo);
        LocalRecordRef.GetTable(LocalRecordSalesCrMemoHeader);
        LocalCodeunitSIMDMSArchiveMgt.OnCodeunitPost(LocalRecordRef, false, true);
    end;
end;

The following parameters are used for the event subscriber:

  • The SalesHeader parameter contains the data record of the "Sales Header" table.
  • The GenJnlPostLine parameter contains the instance of the "Gen. Jnl. post line" code unit. This code unit is used for posting posting lines.
  • The parameters SalesShptHdrNo, RetRcpHdrNo, SalesInvHdrNo and SalesCrMemoHdrNo are codes that refer to different types of documents created in connection with the sale (e.g. sales invoice, sales credit memo, etc.).
  • The parameters CommitIsSuppressed, InvtPickPutaway are boolean values that represent different states or options related to the sale.
  • The parameter CustLedgerEntry is a data record of the "Cust. Ledger Entry" table. This data record contains information about the booking entries that were created in connection with the sale.
  • The parameters WhseShip and WhseReceiv are boolean values that indicate whether the goods have been shipped or received.

The implementation of Shadowprints provides an efficient and reliable method of archiving documents without the need for manual intervention. This functionality greatly facilitates the management of documents in business processes.