Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to open a sales quote when you have the sales quote number?

Posted on by 422

So i have a piece of code below:

procedure OpenQuote(QuoteNotification: Notification)
    var
        QuoteRec: Record "Sales Header";
        QuotePage: Page "Sales Quote";
        QuoteNo: Text;
        QuoteCode: Code[20];
    begin
        QuoteNo := QuoteNotification.GetData('QuoteNumber');
        Evaluate(QuoteCode, QuoteNo);
        if QuoteRec.Get(QuoteCodethen begin
            QuotePage.SetRecord(QuoteRec);
            QuotePage.Run();
        end;
    end;

So my goal is to open the sales quote from the number that is extracted through the QuoteNotification.GetData function. Now note that when i message the QuoteCode it is the acctual correct code from the quote i want to open so having the wrong code is out of question. Now for opening the quote i have the following problem. Let's say i'm working in quote number 1005 and from there i want to open quote number 1001. When i perform the action it just reopens / refeshes (the page blinks) the quote i'm working in, in this case quote number 1005 and it doesn't open quote number 1001. Is there a solution to this problem?

*This post is locked for comments

  • Vignir Einarsson Profile Picture
    Vignir Einarsson 45 on at
    RE: How to open a sales quote when you have the sales quote number?

    Your problem is that the Sales Header has the primary key Document Type and No. and you are just trying to get the No.

           QuoteNo := QuoteNotification.GetData('QuoteNumber');

           Evaluate(QuoteCode, QuoteNo);

           if QuoteRec.Get(QuoteRec."Document Type"::Quote,QuoteCode) then begin

               QuotePage.SetRecord(QuoteRec);

               QuotePage.Run();

           end;

  • Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: How to open a sales quote when you have the sales quote number?

    You can also filter the record and use page.runmodal function.

    QuoteRec.SetRange("Document Type", QuoteRec."Document Type"::Quote);

    QuoteRec.SetRange("No.", QuoteCode);

    Page.RunModal(Page::"Sales Quote", QuoteRec);

  • Verified answer
    Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: How to open a sales quote when you have the sales quote number?

    Hi

    Sales Header has Document Type and No. as the primary key. So you have to mention both when using Get method.

    So change the code accordingly.

    if QuoteRec.Get(QuoteRec."Document Type"::Quote, QuoteCode) then begin

    Regards

    Avinash B

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans