web
You’re offline. This is a read only version of the page.
close
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...
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

I have the same question (0)
  • Suggested answer
    Andy Sather Profile Picture
    on at

    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.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    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
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    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

  • Pooja Zinjurke Profile Picture
    45 on at

    Thanks Andy Sather

  • Pooja Zinjurke Profile Picture
    45 on at

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

  • Pooja Zinjurke Profile Picture
    45 on at

    Thank you YUN 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans