Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Create Purchase quote automatically using records from another page

(0) ShareShare
ReportReport
Posted on by 45

i have created a page that fetch value from job planning line and also in that i have added filled vendor name and that vendor name filled getting a data from vendor table but now i wanted that data needs to be filled in purchase quote automatically or directly create a purchase quote using values from this page

  • Pooja Zinjurke Profile Picture
    Pooja Zinjurke 45 on at
    RE: Create Purchase quote automatically using records from another page

    Thank you YUN ZHU.

  • Pooja Zinjurke Profile Picture
    Pooja Zinjurke 45 on at
    RE: Create Purchase quote automatically using records from another page

    Thank you Inge M. Bruvik, I have verified this and its working.

  • Pooja Zinjurke Profile Picture
    Pooja Zinjurke 45 on at
    RE: Create Purchase quote automatically using records from another page

    Thanks Andy Sather

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 76,911 Super User 2025 Season 1 on at
    RE: Create Purchase quote automatically using records from another page

    Hi, I think you can refer Create Sales Invoice feature in Job Planning Lines page.

    pastedimage1649206930230v1.png

    Some sample code:

    pastedimage1649207009787v2.png

    pastedimage1649207029677v3.png

    pastedimage1649207067750v4.png

    Hope this will help.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 995 Super User 2024 Season 1 on at
    RE: Create Purchase quote automatically using records from another page

    So what you want is a action button in your page that creates the purchase quote?

    You can add an action like this and complete it with your data.

    action(CreatePurchaseQuote)
                {
                    Caption = 'Create purchase quote';
                    ApplicationArea = all;
                    trigger OnAction()
                    var
                        PurchaseHeader: Record "Purchase Header";
                        PurchaseLine: Record "Purchase Line";
                        LineNo: Integer;
                    begin

                        PurchaseHeader.Init();
                        PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Quote;
                        PurchaseHeader."No." := '10000'; // The document No
                        PurchaseHeader.Validate("Buy-from Vendor No.", '10000'); // Your vendorNo
                        //Fill the rest of the fields in the head
                        PurchaseHeader.Insert(true);
                        //Create line
                        //Repeat for every line
                        PurchaseLine.Init();
                        PurchaseLine."Line No." := LineNo;
                        PurchaseLine."Document Type" := PurchaseHeader."Document Type";
                        PurchaseLine."Document No." := PurchaseHeader."No.";
                        PurchaseLine.Type := PurchaseLine.Type::Item;
                        PurchaseLine.Validate(PurchaseLine."No.",'10000'); // Your item no
                        PurchaseLine.Validate(Quantity,1); // Your quantity
                        //fill in the rest of the fields on the line
                        LineNo += 10000;
                        PurchaseLine.Insert(true);
                       

                    end;
                }
  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Create Purchase quote automatically using records from another page

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans