Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request for External] table 1205 "Credit Transfer Register" - procedure Reexport #27950

Open
Eda1996 opened this issue Jan 15, 2025 · 0 comments
Labels
event-request Request for adding an event Finance GitHub request for Finance area

Comments

@Eda1996
Copy link

Eda1996 commented Jan 15, 2025

Describe the request

Hello colleagues,
We want to call function Reexport and be able to save the file to a network path, instead of the default Download folder. Therefore, we are requesting the implementation of an integration event as outlined below.

Before change:

    procedure Reexport()
    var
        CreditTransReExportHistory: Record "Credit Trans Re-export History";
        TempBlob: Codeunit "Temp Blob";
        FileMgt: Codeunit "File Management";
    begin
        TempBlob.FromRecord(Rec, FieldNo("Exported File"));

        if not TempBlob.HasValue() then
            Error(PaymentsFileNotFoundErr);

        CreditTransReExportHistory.Init();
        CreditTransReExportHistory."Credit Transfer Register No." := "No.";
        CreditTransReExportHistory.Insert(true);

        if FileMgt.BLOBExport(TempBlob, StrSubstNo('%1.XML', Identifier), not ExportToServerFile) <> '' then begin
            Status := Status::"File Re-exported";
            Modify();
        end;
    end;

Requested change:

    procedure Reexport()
    var
        CreditTransReExportHistory: Record "Credit Trans Re-export History";
        TempBlob: Codeunit "Temp Blob";
        //Remove>>>>
        FileMgt: Codeunit "File Management";
        //Remove<<<<
    begin
        TempBlob.FromRecord(Rec, FieldNo("Exported File"));

        if not TempBlob.HasValue() then
            Error(PaymentsFileNotFoundErr);

        CreditTransReExportHistory.Init();
        CreditTransReExportHistory."Credit Transfer Register No." := "No.";
        CreditTransReExportHistory.Insert(true);

        //>>>>
        if Export(TempBlob) then begin
        //<<<<
            Status := Status::"File Re-exported";
            Modify();
        end;
    end;

New function:

    local procedure Export(var TempBlob: Codeunit "Temp Blob") Result: Boolean
    var
        FileMgt: Codeunit "File Management";
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeExport(TempBlob, Rec, Result, IsHandled);
        if IsHandled then
            exit(Result);

        exit(FileMgt.BLOBExport(TempBlob, StrSubstNo('%1.XML', Identifier), not ExportToServerFile) <> '');
    end;

Event signature:

    local procedure OnBeforeExport(var TempBlob: Codeunit "Temp Blob"; var CreditTransferRegister: Record "Credit Transfer Register"; var Result: Boolean; var IsHandled: Boolean)
    begin
    end;

Additional context

We have implemented a custom solution that allows exporting a file to a predefined network path.
Internal work item: AB#562590

@JesperSchulz JesperSchulz added request-for-external Request for exposing a function for extension development Finance GitHub request for Finance area event-request Request for adding an event and removed request-for-external Request for exposing a function for extension development labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Finance GitHub request for Finance area
Projects
None yet
Development

No branches or pull requests

2 participants