Skip to main content

Notifications

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. 

  • Shogun Profile Picture
    15 on at
    RE: Dynamically showing and hiding fields

    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;

  • Suggested answer
    JAngle Profile Picture
    95 on at
    RE: Dynamically showing and hiding fields

    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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,063

#2
YUN ZHU Profile Picture

YUN ZHU 1,002 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 810

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans