Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

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

(0) ShareShare
ReportReport
Posted on by 450

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
    47 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
    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
    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans