Skip to main content
Business Central forum
Answered

Create Purchase quote automatically using records from another page

editSubscribe (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

Categories:
  • 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 59,766 Super User 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 32,714 Super User 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.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans