Skip to main content

Notifications

Announcements

No record found.

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

How assigned Attachment PDF Template in sales quote

(0) ShareShare
ReportReport
Posted on by 355

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
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 Season 2 on at
    RE: How assigned Attachment PDF Template in sales quote

    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

  • Suggested answer
    RE: How assigned Attachment PDF Template in sales quote

    Hi Manuel Lozada,

    I hope this blog will help you resolve your issue

    https://yzhums.com/25943/

    Regards,

    YSR.

  • Manuel Lozada Profile Picture
    Manuel Lozada 355 on at
    RE: How assigned Attachment PDF Template in sales quote

    Hi Yogender,

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

    I will appreciate

  • Suggested answer
    RE: How assigned Attachment PDF Template in sales quote

    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

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans