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

I have the same question (0)
  • Verified answer
    Avinash B Profile Picture
    1,455 on at

    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

  • Avinash B Profile Picture
    1,455 on at

    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);

  • Vignir Einarsson Profile Picture
    47 on at

    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;

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 > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans