Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to pass value from one page to another.

(0) ShareShare
ReportReport
Posted on by 350

So on a sales order subform, if a user types unit price, my written onaftervalidate trigger runs and if the condition is met a PageType = NavigatePage;

opens.

Now on this page, if the person chooses to close this page by pressing X on the right corner which captions to Save & Close then I intend to change the value of unit price back to default and that is the Cost Price.

Here is the Page;

page 50140 Password
{
    PageType = NavigatePage;
    ApplicationArea = All;
    UsageCategory = Administration;

    layout
    {
        area(Content)
        {

            field(Password; Password)
            {
                ApplicationArea = All;

                trigger OnValidate()
                var
                    rec_Set: Record "Sales & Receivables Setup";
                begin
                    rec_Set.GET();
                    IF Password = rec_Set.Password then
                        CurrPage.Close()
                    else begin
                        Error('Password Incorrect');
                    end;
                end;

            }

        }
    }


    var
        Password: Text[10];

}

Now the issue is just before the Error I intend to go to the Item table bring the Cost price and set it to the Sales Order Subform to update it so that once the NavigateDialog box closes, user gets to see the Cost Price. Now to find the Item and, of course, I do not have access to Rec.No on this NavigateDialog page so what is the best way to move Rec.No from the Sales Order Subform to my Password Dialog page. 

  • Suggested answer
    Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: How to pass value from one page to another.

    Hi Mesam,

    All you need to do is create a global function with parameters in Page A and call it through Page B by using a pagetype variable.

    For Eg:

    In Page A create

    procedure HelloMessage(Msg: Text)

    begin

    MESSAGE(Msg);

    end;

    In Page B create variable

    PageAVar: Page PageA;

    PageAVar.HelloMessage('Hello World!');

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans