Skip to content

Provided Events in Document Dispatch

This article describes the events provided by Document Dispatch.

Publisher

Codeunit 5487177 "SIM_EDS Event Publisher"

OnBeforeSaveReportDocumentAndSetDefaultDocumentLayout

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeSaveReportDocumentAndSetDefaultDocumentLayout(var ParamDocumentLayoutCode: Code[20]; ParamRecordRef: RecordRef; ParamReportNoInteger: Integer; var ParamLayoutChangedBoolean: Boolean; ParamRecordSIMEDSQueueLine: Record "SIM_EDS Queue Line"; ParamRecordSIMEDSRecordAttachment: Record "SIM_EDS Record Attachment")
begin
end;

Raised

This event is triggered before the configured report in the Document Dispatch dispatch profile is saved in the Document Dispatch queue entry with a report layout.

Parameter

Name Type Description
ParamDocumentLayoutCode Code[20] The code of the report layout.
ParamRecordRef RecordRef The record from which the Document Dispatch sending is triggered.
ParamReportNoInteger Integer The number of the printed report.
ParamLayoutChangedBoolean Boolean Boolean that indicates if the report layout is changed.
ParamRecordSIMEDSQueueLine Record "SIM_EDS Queue Line" The Document Dispatch queue line (record where the queue attachments belong).
ParamRecordSIMEDSRecordAttachment Record "SIM_EDS Record Attachment" The attachment configuration of the dispatch profile.

Info

The report layout can easily be changed by editing the ParamDocumentLayoutCode parameter with an correct report layout code.

OnAfterSaveReportDocument

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterSaveReportDocument(ParamRecordSIMEDSQueueLine: Record "SIM_EDS Queue Line"; ParamRecordSIMEDSRecordAttachment: Record "SIM_EDS Record Attachment")
begin
end;

Raised

This event is triggered after the Document Dispatch Report configured in the Document Dispatch profile attachments is saved into the Document Dispatch queue entry.

Info

This event is triggered after the Document Dispatch queue entry is created even when the report could not be saved because of an error.

Parameter

Name Type Description
ParamRecordSIMEDSQueueLine Record "SIM_EDS Queue Line" The Document Dispatch queue line entry that includeds helpful information.
ParamRecordSIMEDSRecordAttachment Record "SIM_EDS Record Attachment" The Document Dispatch dispatch profile attachments from where the settings of the Document Dispatch queue line is present.

OnBeforeSaveReportEmailTemplate

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeSaveReportEmailTemplate(ParamRecordSIMEDSQueueEntry: Record "SIM_EDS Queue Entry"; ParamRecordSIMEDSRecord: Record "SIM_EDS Record")
begin
end;

Raised

This event is triggered before the Document Dispatch Report configured for the Document Dispatch profile email is saved into the Document Dispatch queue entry.

Parameter

Name Type Description
ParamRecordSIMEDSQueueEntry Record "SIM_EDS Queue Entry" The Document Dispatch queue entry that includeds helpful information.
ParamRecordSIMEDSRecord Record "SIM_EDS Record" The Document Dispatch profile from where the settings of the Document Dispatch queue is present.

OnAfterSaveReportEmailTemplate

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterSaveReportEmailTemplate(ParamRecordSIMEDSQueueEntry: Record "SIM_EDS Queue Entry"; ParamRecordSIMEDSRecord: Record "SIM_EDS Record")
begin
end;

Raised

This event is triggered after the Document Dispatch Report configured for the Document Dispatch profile email is saved into the Document Dispatch queue entry.

Parameter

Name Type Description
ParamRecordSIMEDSQueueEntry Record "SIM_EDS Queue Entry" The Document Dispatch queue entry that includeds helpful information.
ParamRecordSIMEDSRecord Record "SIM_EDS Record" The Document Dispatch profile from where the settings of the Document Dispatch queue is present.

OnBeforeEDSDialogOpen

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeEDSDialogOpen(ParamEDSQueueEntryBigInteger: BigInteger; var ParamToAddressText: Text[250]; var ParamCcAddressText: Text[250]; var ParamBccAddressText: Text[250]; var ParamSubjectText: Text[250])
begin
end;

Raised

This event is triggered before the user sees the Document Dispatch Dialog sending page.

Parameter

Name Type Description
ParamEDSQueueEntryBigInteger BigInteger The Document Dispatch queue enty no. can be used to get the Document Dispatch queue entry record and extract important information from it.
ParamToAddressText Text[250] The filled email to address which can be edited.
ParamCcAddressText Text[250] The filled email cc address which can be edited.
ParamBccAddressText Text[250] The filled email bcc address which can be edited.
ParamSubjectText Text[250] The filled email subject which can be edited.

OnBeforeSendEDS

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeSendEDS(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamSendDialogBoolean: Boolean; ParamRecordCode: Code[50]; ParamIsDownloadBoolean: Boolean; ParamIsSingleDownloadBoolean: Boolean;GlobalIsMultimailBoolean: Boolean; GlobalMultiSelectionBoolean: Boolean)
begin
end;

Raised

This event is triggered before the sending of the Document Dispatch Entry was performed.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamSendDialogBoolean Boolean Contains the information whether the sending was performed as a Dialog sending
ParamRecordCode Code[50] Contains the Dispatch Profile Code
ParamIsDownloadBoolean Boolean Contains the information whether a Download was triggered
GlobalIsMultimailBoolean Boolean Contains the information whether a Multimail was triggered
GlobalMultiSelectionBoolean Boolean Contains the information whether a Multi dispatch was triggered

OnAfterSendEDS

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterSendEDS(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamSendDialogBoolean: Boolean; ParamRecordCode: Code[50]; ParamIsDownloadBoolean: Boolean; ParamIsSingleDownloadBoolean: Boolean;GlobalIsMultimailBoolean: Boolean; GlobalMultiSelectionBoolean: Boolean)
begin
end;

Raised

This event is triggered after the sending of the Document Dispatch Entry was performed.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamSendDialogBoolean Boolean Contains the information whether the sending was performed as a Dialog sending
ParamRecordCode Code[50] Contains the Dispatch Profile Code
ParamIsDownloadBoolean Boolean Contains the information whether a Download was triggered
GlobalIsMultimailBoolean Boolean Contains the information whether a Multimail was triggered
GlobalMultiSelectionBoolean Boolean Contains the information whether a Multi dispatch was triggered

OnBeforeGetBusinessPartner

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeGetBusinessPartner(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamRecordSIMEDSBPRecord: Record "SIM_EDS BP Record"; ParamRecordSIMEDSBusinessPartner: Record "SIM_EDS Business Partner")
begin
end;

Raised

This event is triggered before the business partner gets determined during the sending process.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamRecordSIMEDSBPRecord Record "SIM_EDS BP Record" This Record will be filled with the Dispatch Profiles that are assigned to the Business partner
ParamRecordSIMEDSBusinessPartner Record "SIM_EDS Business Partner" This Record will be filled with the Business partner that is used for the Document Dispatch sending

OnAfterGetBusinessPartner

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterGetBusinessPartner(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamRecordSIMEDSBPRecord: Record "SIM_EDS BP Record"; ParamRecordSIMEDSBusinessPartner: Record "SIM_EDS Business Partner")
begin
end;

Raised

This event is triggered after the business partner gets determined during the sending process.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamRecordSIMEDSBPRecord Record "SIM_EDS BP Record" Contains the Dispatch Profile that are assigned to the Business Partner
ParamRecordSIMEDSBusinessPartner Record "SIM_EDS Business Partner" Contains the Business Partner that is used for the Document Dispatch sending

OnBeforeInsertQueueEntry

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnBeforeInsertQueueEntry(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamRecordSIMEDSBPRecord: Record "SIM_EDS BP Record"; ParamRecordSIMEDSBusinessPartner: Record "SIM_EDS Business Partner")
begin
end;

Raised

This event is triggered before the Document Dispatch queue entry gets created in the sending process.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamSendDialogBoolean Boolean Contains the information whether the sending was performed as a Dialog sending
ParamRecordSIMEDSRecord Record "SIM_EDS Record" Contains the Dispatch Profile that is used for the Document Dispatch sending
ParamRecordSIMEDSQueueEntry Record "SIM_EDS Queue Entry" Contains the Record of the Document Dispatch queue entry that that gets created during the Document Dispatch sending

OnAfterInsertQueueEntry

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterInsertQueueEntry(ParamRecordRef: RecordRef; ParamSendFromFactBoxBoolean: Boolean; ParamRecordSIMEDSBPRecord: Record "SIM_EDS BP Record"; ParamRecordSIMEDSBusinessPartner: Record "SIM_EDS Business Partner")
begin
end;

Raised

This event is triggered after the Document Dispatch queue entry gets created in the sending process.

Parameter

Name Type Description
ParamRecordRef RecordRef The RecordRef that is filled with the record where the Document Dispatch Sending was triggered
ParamSendFromFactBoxBoolean Boolean Contains the information whether the sending was triggered through the factbox
ParamSendDialogBoolean Boolean Contains the information whether the sending was performed as a Dialog sending
ParamRecordSIMEDSRecord Record "SIM_EDS Record" Contains the Dispatch Profile that is used for the Document Dispatch sending
ParamRecordSIMEDSQueueEntry Record "SIM_EDS Queue Entry" Contains the Record of the Document Dispatch queue entry that that gets created during the Document Dispatch sending

OnAfterPlaceholderActionVisible

AL
1
2
3
4
[IntegrationEvent(false, false)]
procedure OnAfterPlaceholderActionVisible(ParamPlaceholderActionVisibleBoolean: Boolean)
begin
end;

Raised

This event is triggered on the Attachments page of the Document Dispatch Profile after a attachment has been selected.

Parameter

Name Type Description
ParamPlaceholderActionVisibleBoolean Boolean Contains the information whether the Placeholder action is shown

OnBeforeSendChangeRecipientEmail

[IntegrationEvent(false, false)]
procedure OnBeforeSendChangeRecipientEmail(
    var ParamRecordSIMEDSQueueEntry: Record "SIM_EDS Queue Entry")
begin
end;

Triggered

This event is triggered just before an email is sent through Document Dispatch, allowing developers to adjust the recipient’s email address with custom code.

Parameters

Name Type Description
ParamRecordSIMEDSQueueEntry Record "SIM_EDS Queue Entry" The current queue entry containing information about the document to be sent. Through the Source ID field, the source record can be accessed to retrieve data for calculations, for example.

Usage

This event allows developers to adjust the recipient email address before sending. By accessing the SIM_EDS Queue Entry, relevant information such as the Source ID can be retrieved to use, for example, the email address of another customer.

Example:

[EventSubscriber(ObjectType::Codeunit, Codeunit::"SIM_EDS Event Publisher", 'OnBeforeSendChangeRecipientEmail', '', false, false)]
procedure HandleOnBeforeSendChangeRecipientEmail(
    var ParamRecordSIMEDSQueueEntry: Record "SIM_EDS Queue Entry")
var
    LocalRecordSalesInvoiceHeader: Record "Sales Invoice Header";
    LocalRecordCustomer: Record Customer;
begin
    if ParamRecordSIMEDSQueueEntry."Source Table No." = 112 then begin
        if LocalRecordSalesInvoiceHeader.Get(ParamRecordSIMEDSQueueEntry."Source ID") then begin
            if LocalRecordCustomer.Get(LocalRecordSalesInvoiceHeader."Sell-to Customer No.") then 
                if LocalRecordSalesInvoiceHeader."Sell-to Customer No." = Format(40000) then
                if LocalRecordCustomer.Get(20000) then
                    ParamRecordSIMEDSQueueEntry."To Address" := LocalRecordCustomer."E-Mail";            
        end;
    end;
end;

In this example, the recipient’s email address is adjusted based on the Source ID of the queue entry. If the sales invoice has a "Sell-to Customer No." of 40000, the email address of the customer with number 20000 is used as the recipient address.