Opening page that depend on bool value

Hi all,

Does anyone have any suggestions how to setup opening page that depend on some bool value in setup table, if some bool value is mark open one page and if is not open default page?

Regards,

Stefan

Best Answer

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    You will need to code opening desired page(s) in every place they are supposed to be used.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • tomasevicstefantomasevicstefan Member Posts: 51
    You will need to code opening desired page(s) in every place they are supposed to be used.

    What if I want to control page opening from menu suite?
  • vivek4121vivek4121 Member Posts: 165
    Hi Slawek,
    You cannot code that directly on the menu, but instead you can point the menu item to a codeunit, and then inside theRUN trigger in the codeunit you can add your code selecting one page or another.

    Can please explain this via an example code?

    Thanks in advance.
  • beharbehar Member Posts: 3

    OnOpenPage()

    BoolValue:=TRUE;
    IF BoolValue = TRUE THEN
    BEGIN
    PAGE.RUNMODAL(30) ;
    CurrPage.CLOSE;
    END;
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Agree with both the solution from @Slawek_Guzek and @behar but something to be noted,

    Normally I don't prefer writing code on OnOpenPage Trigger from performance perspective and too this code of the page will unnecessary get executed if this Page is not supposed to be open depending on Bool

    Writing your code on codeunit makes a sense and its a a good approach but dont make a new Codeunit just for this, anyhow you need to manipulate this,
Sign In or Register to comment.