Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Show/Hide field dynamically in page

(0) ShareShare
ReportReport
Posted on by

Hi everyone, I create a new field in Sales Header table called "Vasilhame" and this field only will be display when I choose a specific Posting No Series. So my idea was to include this field in my page and set the Visible property to a new boolean var I've created called ShowVasilhame.

This var have the option "Include In Dataset" equals to true and now I need to validate the change of Posting no Series equals to a specific text like "MRVFA" then this field should appear in my page, else it may still hide.

I create a function also called SetVasilhameVisibility(Show) where

LOCAL SetVasilhameVisibility(Value : Boolean)
ShowVasilhame:=Value;

Other code...

OnInit()
SetVasilhameVisibility(FALSE);

IF "Posting No. Series"='MRVFA' THEN
  SetVasilhameVisibility(TRUE);

OnOpenPage()
IF "Posting No. Series"='MRVFA' THEN
  SetVasilhameVisibility(TRUE);

Posting No. Series - OnValidate()
IF "Posting No. Series"='MRVFA' THEN
  SetVasilhameVisibility(TRUE);

Posting No. Series - OnLookup(VAR Text : Text) : Boolean

Posting No. Series - OnDrillDown()



My problem is when I change the posting no series, because it stays visible and don't hide anymore...

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Show/Hide field dynamically in page

    So I create a Group with the field Vasilhame inside and with the option visible equals to "ShowVasilhame". Then I add this code in OnValidate

    Posting No. Series - OnValidate()
    SetVasilhameVisibility("Posting No. Series"='MRVFA');

    And I've update my SetVasilhameVisibility function to

    SetVasilhameVisibility(Value : Boolean)
    MESSAGE('vasilhame %1 ',Value);
    ShowVasilhame:=Value;
    CurrPage.UPDATE(FALSE);

    But nothing changed.. The message is not being pop when I change the posting no series... any idea?

    I've also remove the code in onInit and onOpenPage to validate the posting series no..

  • Suggested answer
    I Gusti Made Ari Profile Picture
    3,594 on at
    RE: Show/Hide field dynamically in page

    You need to Put this "Vasilhame" inside the group , and set the visible  property on the group level instead. This will hide it  when you are validating Posting No.

  • Community Member Profile Picture
    on at
    RE: Show/Hide field dynamically in page

    Yes, the field vasilhame in the Visible property have "ShowVasilhame".. is this wrong?  I assign ShowVasilhame value with SetVasilhameVisibility Function....

  • Suggested answer
    Mohana Yadav Profile Picture
    60,228 Super User 2025 Season 1 on at
    RE: Show/Hide field dynamically in page

    did you set this boolean field in Visible property of the field that you want to hide? ShowVasilhame

  • Community Member Profile Picture
    on at
    RE: Show/Hide field dynamically in page

    I've add only code there and nothing... i've tried to add also in OnInit / OnOpenPage / OnNewRecord and nothing.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,228 Super User 2025 Season 1 on at
    RE: Show/Hide field dynamically in page

    it should be under

    Posting No. Series - OnValidate()

  • Community Member Profile Picture
    on at
    RE: Show/Hide field dynamically in page

    The problem is that when I change the Posting No Series Code to another series like MRVFL this field should hide but stills visible..

    OnInit()
    
    SetVasilhameVisibility("Posting No. Series"='MRPV1');
    
    OnOpenPage()
    
    
    SetVasilhameVisibility("Posting No. Series"='MRPV1');
    
    Posting No. Series - OnValidate()
    
    Posting No. Series - OnLookup(VAR Text : Text) : Boolean
    
    Posting No. Series - OnDrillDown()
    SetVasilhameVisibility("Posting No. Series"='MRPV1');
  • Suggested answer
    Mohana Yadav Profile Picture
    60,228 Super User 2025 Season 1 on at
    RE: Show/Hide field dynamically in page

    where ever you have written earlier.

  • Community Member Profile Picture
    on at
    RE: Show/Hide field dynamically in page

    In which trigger/function of the code?

  • Suggested answer
    Mohana Yadav Profile Picture
    60,228 Super User 2025 Season 1 on at
    RE: Show/Hide field dynamically in page

    try SetVasilhameVisibility("Posting No. Series"='MRVFA');

    no need of If condition

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

🌸 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…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans