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)

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

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,999 Super User 2025 Season 2 on at

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

    no need of If condition

  • Community Member Profile Picture
    on at

    In which trigger/function of the code?

  • Suggested answer
    Mohana Yadav Profile Picture
    60,999 Super User 2025 Season 2 on at

    where ever you have written earlier.

  • Community Member Profile Picture
    on at

    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,999 Super User 2025 Season 2 on at

    it should be under

    Posting No. Series - OnValidate()

  • Community Member Profile Picture
    on at

    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,999 Super User 2025 Season 2 on at

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

  • Community Member Profile Picture
    on at

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

  • Suggested answer
    I Gusti Made Ari Profile Picture
    3,600 on at

    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

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

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