Skip to content

DocXtender

Trouble decoding ptxtb64FileContent for OnBeforeHandleDocumentAttachDropEvent

Viewing 2 posts – 1 through 2 (of 2 total)
  • Author
    Posts
  • #8726
    Vincent V.

    We wrote an integration to std BC Document Attachment to capture the storage to Tenant Media and handle this differently. This works well when attaching files via standard BC functionality.

    However, The DocXtender factbox (v2.2.9133.1) stores dropped files directly in the Document Attachment table without using the functions BC provides. When we use the OnBeforeHandleDocumentAttachDropEvent event to capture this drop we have issues decoding the ptxtb64FileContent parameter.

    The standard BC Base 64 decode function will corrupt the file.

    See also this thread: https://community.dynamics.com/forums/thread/details/?threadid=c217cf53-0037-4835-a110-6462e39df358

    The thread proposes using the Base64 codeunit created by Arend-Jan Kauffmann (https://github.com/ajkauffmann/ALCodeSamples/tree/master/Base64Convert). This CU will do this correctly, but will often hang extremely long with certain files (usually PDFs).

    Can DocXtender, in a future version perhaps, use the methods provided by standard BC?

    Alternatively, how is DocXtender decoding the ptxtb64FileContent ?

    #10446
    Travis P.
    Insight Works

    Here is an example of how to decode the ptxtb64FileContent:

    local procedure DecodeBase64(ptxtb64FileContent: Text)

    var

    lcuTempBlob: Codeunit “Temp Blob”;

    lcuBase64Convert: Codeunit “Base64 Convert”;

    losOutStream: OutStream;

    lisInStream: InStream;

    ltxtTextOut: Text;

    begin

    lcuTempBlob.CreateInStream(lisInStream);

    lcuTempBlob.CreateOutStream(losOutStream);

    lcuBase64Convert.FromBase64(ptxtb64FileContent, losOutStream);

    lisInStream.ReadText(ltxtTextOut);

    Message(ltxtTextOut);

    end;

Viewing 2 posts – 1 through 2 (of 2 total)
  • Sign in below to reply.