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 :
Small and medium business | Business Central, N...
Suggested Answer

Dynamically showing and hiding fields

(0) ShareShare
ReportReport
Posted on by 15

Hello, so I have two fields, Employee and Applicant which table relate to their respective entities. I want to develop them in such a way that if a record is fetched in Employee, the Applicant field becomes hidden and vice-versa. Any idea of how I can achieve this?

I've tried playing around with some IF statement logic but it doesn't seem to work. 

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    I would create a variable and assign it to the Visible property of the field. The validation of the variable could be determined on validation of the field or from a page trigger like OnOpenPage. Once you have determined the right place to trigger the logic you can use an IF statement like IF Applicant <>'' then VisibilityVariable := true;

    A boolean variable is by default false.

    This link may help: docs.microsoft.com/.../devenv-visible-property

  • Shogun Profile Picture
    15 on at

    Hi, so that was my first solution. I used the visibility property together with if statements and triggers. But it doesn't seem to work. would you know of any other way? or could you check if this code has issues

                   field(Employee; Employee)

                   {

                       ApplicationArea = All;

                       Visible = AppVisible;

                       trigger OnValidate()

                       begin

                           if Employee <> '' then

                               AppVisible := false;

                       end;

                   }

                   field(Applicant; Applicant)

                   {

                       Visible = EmpVisible;

                       ApplicationArea = All;

                       trigger OnValidate()

                       begin

                           if Applicant <> '' then

                               EmpVisible := false;

                       end;

                   }

    Var      

           EmpVisible: Boolean;

           AppVisible: Boolean;

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans