Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to read blob file in nav

(1) ShareShare
ReportReport
Posted on by 133

Can you please check where i am wrong

TemplateTable.CALCFIELDS(ImportTemp);
IF TemplateTable.GET('141') THEN
TempBlob.Blob.CREATEINSTREAM(Ins);
WHILE NOT Ins.EOS DO BEGIN
Ins.READTEXT(EmailTemplateBody);
MESSAGE('%1',EmailTemplateBody);
END;

  • AjayPandey Profile Picture
    133 on at
    RE: How to read blob file in nav

    I want to read  HTML templates which i have already import in templates table and i want to  use this templates in email to customers

    mention below are the codes for import templates.


    ImportTemplate - OnAction()
    Rec.CALCFIELDS(ImportTemp);
    IF Rec.ImportTemp.HASVALUE THEN
    MESSAGE('Template is alredy Uploaded');
    IF NOT CONFIRM('Do you want to ReUpload?') THEN
    EXIT;

    FileName := Filemgm.BLOBImportWithFilter(TempBlob, 'Upload File', '', 'All Files (*.*)|*.HTML*', '.HTML');
    TempBlob.Blob.CREATEINSTREAM(Ins);
    Rec.ImportTemp.CREATEOUTSTREAM(Outs);
    COPYSTREAM(Outs, Ins);
    IF TempBlob.Length()>5000000 THEN
    ERROR('File size must be less than or equal to 3MB')
    ELSE BEGIN
    Rec.MODIFY(TRUE);
    MESSAGE('File Uploaded');
    END;

    ExportTemplate - OnAction()
    Rec.CALCFIELDS(ImportTemp);
    Rec.ImportTemp.CREATEINSTREAM(Ins);
    TempBlob.Blob.CREATEOUTSTREAM(Outs);
    COPYSTREAM(Outs,Ins);
    IF Rec.ImportTemp.HASVALUE THEN
    FilemngCU.BLOBExport(TempBlob, FileName + 'Parcel.html', TRUE)
    ELSE
    ERROR('File Not found');

  • Suggested answer
    Nitin Verma Profile Picture
    21,465 Moderator on at
    RE: How to read blob file in nav

    Hi,

    You can have an idea by going to Sales Header Table and find the function to get and set work description.

       procedure SetWorkDescription(NewWorkDescription: Text)
        var
            OutStream: OutStream;
        begin
            Clear("Work Description");
            "Work Description".CreateOutStream(OutStream, TEXTENCODING::UTF8);
            OutStream.WriteText(NewWorkDescription);
            Modify();
        end;
    
        procedure GetWorkDescription() WorkDescription: Text
        var
            TypeHelper: Codeunit "Type Helper";
            InStream: InStream;
        begin
            CalcFields("Work Description");
            "Work Description".CreateInStream(InStream, TEXTENCODING::UTF8);
            exit(TypeHelper.TryReadAsTextWithSepAndFieldErrMsg(InStream, TypeHelper.LFSeparator(), FieldName("Work Description")));
        end;

  • Suggested answer
    YUN ZHU Profile Picture
    79,326 Super User 2025 Season 1 on at
    RE: How to read blob file in nav

    Hi, hope the following helps.

    pastedimage1686268342493v1.png

    pastedimage1686268347418v2.png

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,011 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans