Skip to content

[Extensibility] [E-Document] Publisher in "E-Document Mailing" #8566

@GOB-Wijaya

Description

@GOB-Wijaya

BC Idea Link

microsoft/ALAppExtensions#30234

Description

In Codeunit 6188 "E-Document Emailing"

Allow update through publisher on the statement if the TempBlobList is set as attachments separately or as .zip archive.
In our case, we would like to create a .zip archive based on the document sending profile instead of the number of TempBlobs.

We would like to implement these changes

New Publisher

 [IntegrationEvent(false, false)]
    local procedure OnBeforeCreateAttachmentsBlob(
        var TempBlobList: Codeunit "Temp Blob List";
        var ExtensionList: List of [Text];
        DocumentSendingProfile: Record "Document Sending Profile";
        ReportUsage: Enum "Report Selection Usage";
        RecordVariant: Variant;
        DocNo: Code[20];
        DocName: Text[150];
        ToCust: Code[20];
        var AttachmentFileName: Text[250];
        var AttachmentFileExtension: Text;
        var TempBlob: Codeunit "Temp Blob";
        var IsHandled: Boolean)
    begin
    end;

Code placement

local procedure CreateAttachmentsBlob(
        DocumentSendingProfile: Record "Document Sending Profile";
        ReportUsage: Enum "Report Selection Usage";
        RecordVariant: Variant;
        DocNo: Code[20];
        DocName: Text[150];
        ToCust: Code[20];
        var AttachmentFileName: Text[250];
        var AttachmentFileExtension: Text): Codeunit "Temp Blob"
    var
        DataCompression: Codeunit "Data Compression";
        TempBlob: Codeunit "Temp Blob";
        IsHandled: Boolean; // new line
    begin
        OnBeforeCreateAttachmentsBlob(GlobalTempBlobList, GlobalExtensionList, DocumentSendingProfile, ReportUsage, RecordVariant, DocNo, DocName, ToCust, AttachmentFileName, AttachmentFileExtension, TempBlob, IsHandled); // new line
        If IsHandled then // new line
            exit(TempBlob); // new line

        if GlobalTempBlobList.IsEmpty() then
            exit(TempBlob);

        AttachmentFileName := CreateAttachmentName(DocNo, DocName);
        if (GlobalTempBlobList.Count() = 1) and (DocumentSendingProfile."E-Mail Attachment" = Enum::"Document Sending Profile Attachment Type"::"E-Document")
        then begin
            GlobalTempBlobList.Get(1, TempBlob);
            AttachmentFileExtension := GlobalExtensionList.Get(1);
        end else begin
            CreateZipArchiveWithEDocAttachments(DataCompression, GlobalTempBlobList, AttachmentFileName);

            if DocumentSendingProfile."E-Mail Attachment" = Enum::"Document Sending Profile Attachment Type"::"PDF & E-Document" then
                AddPdfAttachmentToZipArchive(DataCompression, ReportUsage, RecordVariant, ToCust, AttachmentFileName);

            DataCompression.SaveZipArchive(TempBlob);
            DataCompression.CloseZipArchive();
            AttachmentFileExtension := ZipFileTypeTok;
        end;
        exit(TempBlob);
    end;

I will provide the implementation for this BC Idea

  • I will provide the implementation for this BC Idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    BCIdeaIssue related to a BCIdeaIntegrationGitHub request for Integration area
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions