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

auto upload attachments to document attachment

(2) ShareShare
ReportReport
Posted on by
I have a requirement which is running a sales order report and then upload that same report to Document attachment table as an attachment automatically.
How to do it?
  • Suggested answer
    YUN ZHU Profile Picture
    81,910 Super User 2025 Season 1 on at
    auto upload attachments to document attachment
    Hi, if you are referring to printing Sales - Confirmation, I hope the following code can give you some tips.
    pageextension 50132 MyExtension extends "Sales Order"
    {
        actions
        {
            modify("Print Confirmation")
            {
                trigger OnAfterAction()
                var
                    SalesHeader: Record "Sales Header";
                    DocPrint: Codeunit "Document-Print";
                begin
                    SalesHeader := Rec;
                    SalesHeader.SetRecFilter();
                    DocPrint.PrintSalesOrderToDocumentAttachment(SalesHeader, 1);
                end;
            }
        }
    }
    
     
    Thanks
    ZHU
  • Shathika Karunaratne Profile Picture
    on at
    auto upload attachments to document attachment
    Yael, 
     
    Could you please send a sample code for that if possible?
  • Suggested answer
    YUN ZHU Profile Picture
    81,910 Super User 2025 Season 1 on at
    auto upload attachments to document attachment
    I have had similar discussions, and I hope you can refer to the following information.
    Dynamics 365 Business Central: Automatically attaching as PDF to posted sales invoice (Document Attachment)
    Dynamics 365 Business Central: How to copy attachments from Warehouse Receipt to Posted Warehouse Receipt – Customization
     
    Hope this helps.
    Thanks.
    ZHU
     
  • Yael Suarez Profile Picture
    117 on at
    auto upload attachments to document attachment
    Save the report in Base64 aun Upload into Blob field inside of attachment table
     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,349 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,029 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans