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...
Suggested Answer

How assigned Attachment PDF Template in sales quote

(0) ShareShare
ReportReport
Posted on by 371

Hi Community,

I have a problem in how I can to assigned a sales quote template in attachment PDF action:

This is my scenario:

I am using two templates in sales quote, the last one is the template that now is attachment PDF for default:

pastedimage1683208020809v1.png

I created other button similar attach pdf, but my inquiry is how I can do to assign this specific template  "Quote Long Description" to the new button.

pastedimage1683209799261v2.png

This is my code:

 action(AttachAsPDF2)
            {
                ApplicationArea = Basic, Suite;
                Caption = 'Attach as PDF LongDesc';
                //Enabled = IsCustomerOrContactNotEmpty;
                Image = PrintAttachment;
                ToolTip = 'Create a PDF file and attach it to the document.';
                Promoted = true; // add prometed area
                PromotedCategory = Category9; // add prometed category
                Visible = true;

                trigger OnAction()
                var
                    SalesHeader: Record "Sales Header";
                begin
                    ClearLastError();
                    Commit();
                    CurrPage.SetSelectionFilter(Rec);
                    SalesHeader := Rec;
                    SalesHeader.SetRecFilter();
                    DocPrint.PrintSalesHeaderToDocumentAttachment(SalesHeader);
                end;
            }
If you know how I can fix it, I will appreciate.
Thank you
I have the same question (0)
  • Suggested answer
    Yogender Singh Rana Profile Picture
    80 on at

    Hi Manuel Lozada,

    You can select your preferred Layout by using the function "SetTempLayoutSelected" in table 9651 "Report Layout Selection".

    Just use this function before running the report (report.run).

    I hope this helps resolve your issue.

    Regards,

    Yogender Singh Rana

  • Manuel Lozada Profile Picture
    371 on at

    Hi Yogender,

    thanks for answered, Maybe do you have some AL example?

    I will appreciate

  • Suggested answer
    Yogender Singh Rana Profile Picture
    80 on at

    Hi Manuel Lozada,

    I hope this blog will help you resolve your issue

    https://yzhums.com/25943/

    Regards,

    YSR.

  • Suggested answer
    YUN ZHU Profile Picture
    98,064 Super User 2026 Season 1 on at

    Hi, just to add some info.
    We can choose the report layout on request page (Select a report layout before printing) since BC21.
    https://yzhums.com/29568/

    Hope this can give you some helps as well.

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,032 Super User 2026 Season 1

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,049 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 1,029 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans