web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Version 14 and version 15 Business Central

(0) ShareShare
ReportReport
Posted on by 700

Hi All,

I have developed an extension in Business Central version 14 and now, want to publish it to version 15. But, it is showing error on record 'TempBlob'. Could anyone please tell me the alternative to this method which can be used in version 15 !

Thanks !

  • Suggested answer
    Oleksandr Shevchuk Profile Picture
    175 on at

    Hi,

    For version 15 version, you will need to use the BLOB Storage Module instead of the Tempblob table.

    You can find some useful information regarding your question in the BLOB Storage Module section by the following link:

    github.com/.../BREAKINGCHANGES.md

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Thanks for your information. But I am very new to Business Central. Could you please modify the source code for me !

    procedure UploadFile(CountryPolicy: Record CountryPolicy)

       var

           TempBlob: Record TempBlob;

           FileManagement: Codeunit "File Management";

           FileName: Text;

           ImportTxt: Label 'Upload File';

           FileDialogTxt: Label 'Attachments (%1)|%1';

           FilterTxt: Label '*.jpg;*.jpeg;*.bmp;*.png;*.gif;*.tiff;*.tif;*.pdf;*.docx;*.doc;*.xlsx;*.xls;*.pptx;*.ppt;*.msg;*.xml;*.*';

       begin

           FileName := FileManagement.BLOBImportWithFilter(TempBlob, ImportTxt, FileName, STRSUBSTNO(FileDialogTxt, FilterTxt), FilterTxt);

           CountryPolicy."Attached Country Policy " := TempBlob.Blob;

           IF CountryPolicy."Attached Country Policy ".HASVALUE THEN BEGIN

               CountryPolicy."Country Policy File Name" := COPYSTR(FileManagement.GetFileNameWithoutExtension(FileName), 1, MAXSTRLEN(CountryPolicy."Country Policy File Name"));

               CountryPolicy."Country Policy File Extension" := LOWERCASE(COPYSTR(FileManagement.GetExtension(FileName), 1, MAXSTRLEN(CountryPolicy."Country Policy File Extension")));

               CountryPolicy."Country Policy Attached" := TRUE;

               CountryPolicy.MODIFY;

           END;

       end;

       procedure DownloadFile(CountryPolicy: Record CountryPolicy)

       var

           TempBlob: Record TempBlob;

           FileManagement: Codeunit "File Management";

       begin

           IF CountryPolicy."Attached Country Policy ".HASVALUE THEN BEGIN

               CountryPolicy.CALCFIELDS("Attached Country Policy ");

               TempBlob.Blob := CountryPolicy."Attached Country Policy ";

               FileManagement.BLOBExport(TempBlob, CountryPolicy."Country Policy File Name" + '.' + CountryPolicy."Country Policy File Extension", TRUE);

           END;

       END;

  • Verified answer
    Oleksandr Shevchuk Profile Picture
    175 on at

    Your code needs to be rewritten in the following way:

        procedure UploadFile(CountryPolicy: Record CountryPolicy)

        var
            // TempBlob: Record TempBlob;
            TempBlob: Codeunit "Temp Blob";

            FileManagement: Codeunit "File Management";
            RecordRef: RecordRef;

            FileName: Text;

            ImportTxt: Label 'Upload File';

            FileDialogTxt: Label 'Attachments (%1)|%1';

            FilterTxt: Label '*.jpg;*.jpeg;*.bmp;*.png;*.gif;*.tiff;*.tif;*.pdf;*.docx;*.doc;*.xlsx;*.xls;*.pptx;*.ppt;*.msg;*.xml;*.*';

        begin

            FileName := FileManagement.BLOBImportWithFilter(TempBlob, ImportTxt, FileName, StrSubstNo(FileDialogTxt, FilterTxt), FilterTxt);

            // CountryPolicy."Attached Country Policy " := TempBlob.Blob;

            RecordRef.GetTable(CountryPolicy);
            TempBlob.ToRecordRef(RecordRef, CountryPolicy.FieldNo("Attached Country Policy "));
            RecordRef.SetTable(CountryPolicy);

            if CountryPolicy."Attached Country Policy ".HasValue() then begin

                CountryPolicy."Country Policy File Name" := CopyStr(FileManagement.GetFileNameWithoutExtension(FileName), 1, MAXSTRLEN(CountryPolicy."Country Policy File Name"));

                CountryPolicy."Country Policy File Extension" := LowerCase(CopyStr(FileManagement.GetExtension(FileName), 1, MAXSTRLEN(CountryPolicy."Country Policy File Extension")));

                CountryPolicy."Country Policy Attached" := true;

                CountryPolicy.Modify();

            end;

        end;

        procedure DownloadFile(CountryPolicy: Record CountryPolicy)

        var

            // TempBlob: Record TempBlob;
            TempBlob: Codeunit "Temp Blob";

            FileManagement: Codeunit "File Management";

        begin

            if CountryPolicy."Attached Country Policy ".HasValue() then begin

                CountryPolicy.CalcFields("Attached Country Policy ");

                // TempBlob.Blob := CountryPolicy."Attached Country Policy ";
                TempBlob.FromRecord(CountryPolicy, CountryPolicy.FieldNo("Attached Country Policy "));

                FileManagement.BLOBExport(TempBlob, CountryPolicy."Country Policy File Name" + '.' + CountryPolicy."Country Policy File Extension", true);

            end;

        end;

    P.S. It seems that I give you a broken link in my previous answer, so here is the correct one:

    [View:https://github.com/microsoft/ALAppExtensions/blob/master/BREAKINGCHANGES.md:750:50]

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Thank you so much, sir. It worked !

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 631 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 409 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 222 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans