Skip to content

Archiving of customer-specific Reports

The DMS Connector offers the option of archiving some Business Central standard reports according to the setup. These are listed in the table below. Documents that are to be archived on print or sent per email do not require individual development - they only need to be set up in a DMS Archive Setup Template.

If the archiving of further standard or custom reports is desired, the feasibility must first be checked and then implemented. It is advisable to get in touch with your contact person at TSO first to discuss the feasibility of your request and the most suitable approach. If you would like to take on the task of archiving the desired reports yourself using the DMS Connector, you can use the explanation in the following section to help you.

Essentials for the custom Report Archiving

Requirements

  • Dependency to the DMS Connector app
  • Dependency to the DMS Core app

Simple uploading of files

The Codeunit 5371110 "MF Object Mgt.TDMS" provides the following function for the simple uploading of files:

procedure UploadFileSilent(RecAsVariant: Variant; Filename: Text; FileContentTempBlob: Codeunit "Temp Blob"; TableSetupCode: Code[20]; ClassID: Integer): Boolean
  • Parameters of UploadFileSilent: <br>

    • RecAsVariant - the record to be used for the report.
    • Filename - the report name to be assigned.
    • FileContentTempBlob - the report content as BLOB.
    • TableSetupCode - the code of the table setup to be used for the report.

    Info

    An empty value ('') can also be passed here. The DMS Connector will then search for a table setup linked to the source table. However, if there are several table setups for the same source table, no unambiguous result can be returned.

    • ClassID - the ID of the M-Files class that the report should be assigned to in M-Files.

Remark

There must always be a table setup for the source table to which the record belongs. Furthermore, the table setup must be active and it must contain the M-Files class ClassID.

Custom trigger-based archiving

If documents are to be archived on triggers other than those implemented by default, additional development is required. The codeunit 71178310 Public APICTDMS provides the following functions for this purpose:

procedure CreateNewTrigger(TriggerName: Text[100]; ObjectType: Enum "Object TypeCTDMS"; ObjectID: Integer; TriggerDescription: Text[250]; TargetTableId: Integer): Boolean
procedure HandleDocumentArchiving(RecAsVariant: Variant; ArchiveSetupCTDMS: Record "Archive SetupCTDMS"; ArchiveTrigger: Enum "Archive TriggerCTDMS"): Boolean
procedure HandleDocumentArchiving(RecAsVariant: Variant; ArchiveSetupCTDMS: Record "Archive SetupCTDMS"; ArchiveTrigger: Enum "Archive TriggerCTDMS"; Filename: Text): Boolean

Implementation

  1. (Development) Recommendation: Create a codeunit of type (subtype) Install or Upgrade where the new trigger is added during the app installation or app update.
  2. (Development) Create a new trigger (event, action, etc.) using CreateNewTrigger in the Archive TriggerCTDMS table.
    The new trigger will then be visible on the [Archiving Events] page, which can be accessed via [DMS Archive Setup]. It can also be assigned to archive setups.
  3. (Development) Implement the archiving using HandleDocumentArchiving inside the trigger. Event should be passed as ArchiveTrigger.

    Filter Archive Setup

    The appropriate archive setup required for archiving can be filtered and retrieved using the trigger name.

  4. (Setup) Assign the new trigger from step 1 to an archive setup and activate it.
  5. (Test) Trigger the corresponding event and check the correctness of your implementation.

Custom scheduled archiving

If documents other than those implemented in standard posting transactions are to be archived on a scheduled basis, additional development is required. The codeunit 71178310 Public APICTDMS provides the following functions for this purpose:

procedure CreateNewScheduledLogEntry(DocumentNo: Code[20]; TableNo: Integer; RecordID: RecordId; SellToCustomerNo: Code[20]; BillToCustomerNo: Code[20]; PostingDate: Date; DocumentDate: Date; PostingDescription: Text[100]; ResponsibilityCenter: Code[10]): Boolean
procedure HandleDocumentArchiving(RecAsVariant: Variant; ArchiveSetupCTDMS: Record "Archive SetupCTDMS"; ArchiveTrigger: Enum "Archive TriggerCTDMS"): Boolean
procedure HandleDocumentArchiving(RecAsVariant: Variant; ArchiveSetupCTDMS: Record "Archive SetupCTDMS"; ArchiveTrigger: Enum "Archive TriggerCTDMS"; Filename: Text): Boolean

Implementation

There are two options for schedule-based archiving of documents:

Option 1: Extension
  1. (Development) Create a new entry using CreateNewScheduledLogEntry in the Scheduled Archive LogCTDMS table during a desired event.
  2. (Setup) Set up a new scheduled Archive Setup Template for the event-triggering table. Complete and activate the corresponding archive setup.
  3. (Setup) Insert codeunit 71178308 Scheduled Docs. ArchivingCTDMS and start it.
Option 2: Custom implementation
  1. (Development) If necessary, create your own log table and fill it/custom logic
  2. (Development) Implement the archiving using HandleDocumentArchiving in a new job. The ArchiveTrigger to be passed should be Job.

    Filter Archive Setup

    The appropriate archive setup required for archiving can be determined and retrieved, for example, using the fields Arch. Setup Templ. Scheduled and Arch. Setup Templ. Table No.. As these are FlowFields, they must be calculated beforehand.

  3. (Setup) Set up a new scheduled Archive Setup Template for the associated table. Complete and activate the corresponding archive setup.
  4. (Setup) Insert and start the job from step 2.

Handling of individual report layouts

Note

The functions in this section are already called in the HandleDocumentArchiving function. An additional call is therefore not necessary.

Separate report layouts can be set up in a customer and vendor card under [Document layouts]. The following function in codeunit 71178310 Public APICTDMS can be used to take these into account for individual document archiving:

procedure HandleCustomReportLayout(MyRecordRef: RecordRef; ReportId: Integer)

After handling the report layout, the function below must also be called up to reset the layout.

procedure ClearCustomReportLayout()

Standard reports integrated in the DMS Connector

Category Trigger Name
Purchase Release Purchase Quote
Purchase Release Purchase Order
Purchase Release Blanket Purchase Order
Purchase Release Purchase Return Order
Purchase Posting (scheduled) Posted Return Shipments
Sales Release Sales Quote
Sales Release Sales Order
Sales Release Blanket Sales Order
Sales Release Sales Return Order
Sales Posting (scheduled) Posted Sales Shipment
Sales Posting (scheduled) Posted Sales Invoice
Sales Posting (scheduled) Posted Sales Credit Memo
Sales Posting (scheduled) Posted Return Receipt
Sales Posting (scheduled) Posted Service Invoice
Sales Posting (scheduled) Posted Service Credit Memo
Sales Posting (scheduled) Posted Service Shipment
Sales Posting (scheduled) Issued Reminder