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 373

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
  • 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
    373 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
    104,157 Super User 2026 Season 2 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

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 554 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 360 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 201 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans