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

Hide field in Worksheet Page

(7) ShareShare
ReportReport
Posted on by 204
Hi All,
 

I have created a custom field, Tour Type, which is an enum field in the standard table Gen. Journal Line using a table extension in AL code.

If the batch is selected as EXPENSE, the custom field will be displayed on the Bank Payment Voucher page; otherwise, it will be hidden.

I have written the code in the PageExtension on the OnAfterGetCurrent trigger.  The global variable shows True in the debugger, but the field is not hidden at the page level.

Please advice.

I have the same question (0)
  • Sohail Ahmed Profile Picture
    11,136 Super User 2025 Season 2 on at

    It sounds like you’re on the right track, but in worksheet pages the Visible logic can be a bit tricky. Could you share the snippet of your AL code (table extension + page extension part) so we can see exactly how you’ve set the Visible property and where you’re updating it? That will make it easier to spot why the field isn’t hiding.

     

    ✅ Mark this as the verified answer if helpful.

  • CU08050848-0 Profile Picture
    204 on at
    Hello Sohail,
     
    Thanks for the reply. Below is the code screenshot. I have also tired to hide under group but not working.
     
    A  created a custom enum field 'Tour Type' in the 'Gen. Journal Line' table extension in AL code and wants to conditionally hide this field on the 'Bank Payment Voucher' page based on the batch type. Although the global variable controlling visibility shows 'True' in the debugger, the field is not hidden on the page. The user has tried hiding the field within a group without success. Community members suggest sharing the AL code snippets for the table and page extensions to better diagnose the issue, noting that visibility logic on worksheet pages can be tricky.
     
     



  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    Hi, hope the following helps.
    Dynamics 365 Business Central: Dynamic Visibility of Controls (Hide and show fields dynamically)
    Dynamics 365 Business Central: Add new actions (Show more and Show less) to show and hide subgroups on the page
    https://yzhums.com/61946/
     
    Thanks.
    ZHU
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,275 Super User 2025 Season 2 on at
  • Suggested answer
    Sumit Singh Profile Picture
    10,079 on at
    Hi, 
     
    To dynamically show or hide the Tour Type field on the Bank Payment Voucher page based on the batch name, you can try the following:

    Key Requirements

    1. Use the Visible property with a global Boolean variable:
    field("Tour Type"; Rec."Tour Type")
    {
        Visible = ShowTourType;
    }
    1. Set the variable in the correct trigger:
      • Prefer OnAfterGetRecord() for list pages [1].
      • Use OnAfterGetCurrRecord() for card or document pages [2].
    2. Declare the variable as global in the page extension:
    var
        ShowTourType: Boolean;
    1. Update the variable based on the batch name:
    trigger OnAfterGetCurrRecord()
    begin
        ShowTourType := Rec."Journal Batch Name" = 'EXPENSE';
    end;

    Note: This answer is based on my understanding, with Microsoft Copilot helping me organize and polish the wording.
    Mark the Boolean true “Does this answer your Question” if this was Helpful.

     
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,527 Super User 2025 Season 2 on at
    I hope below can help you. You can use personalization on some pages if not you need set the property visiable
     
     
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.

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