web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Hiding Unused Option/Enum Values

(5) ShareShare
ReportReport
Posted on by 760
We would like to hide any Option or Enum values that we don't want users to enter.  A simple example is the Debit/Credit field in the Chart of Accounts.  There is an option value "Both" that we don't want used.  We have some GL reporting that looks at this field, and based on if the value is Debit or Credit, the calculation is different.  If Both is used, it throws off the formulas.  It is my understanding this field has no functional value in BC.
 
There are other fields where we don't want to show Options or Enums that should not be used.
 
It does not appear that the ValuesAllowed or OptionMembers properties can be modified in VS Code for standard fields.  I know it can be done for custom fields in Table Extensions.
 
What is the correct approach to limiting the value options?  Do we have to add new fields to tables and pages, hide the existing Page fields, then add triggers to update the base fields with the correct values?  Seems a bit much.
 
Thanks.
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    101,250 Super User 2026 Season 1 on at
    Hi, hope the following helps.
    Dynamics 365 Business Central: Hiding enum values on the page (ValuesAllowed Property)
     
    Thanks.
    ZHU
  • ME-31032107-0 Profile Picture
    760 on at
     
    I had read your article on this topic, and do understand that the ValuesAllowed Property can be used on custom table fields, but not when attempting to modify a standard BC field.  How can I do that?
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,306 Super User 2026 Season 1 on at
    Can you do it in the page extension field?
  • Suggested answer
    Suresh Kulla Profile Picture
    50,278 Super User 2026 Season 1 on at
    You can achieve your scenario with some custom code in a Page Extension, but remember to ensure that there are no existing records with the value you want users to avoid selecting. Below is the sample code
     
    pageextension 72101 "Chart of Accounts Ext" extends "G/L Account Card"
    {
        layout
        {
            modify("Debit/Credit")
            {
                Visible = false;
            }
            addafter("Account Category")
            {
                field(DebitCredit; DebitCredit)
                {
                    ApplicationArea = All;
                    Caption = 'Debit/Credit';
                    ToolTip = 'Specifies whether the account is a debit or credit account.';
    
                    trigger OnValidate()
                    begin 
                        Rec.Validate("Debit/Credit",DebitCredit)
                    end;
                }
            }
        }
    
       trigger OnAfterGetCurrRecord()
        begin
            DebitCredit := Rec."Debit/Credit";
        end;
        
        var
            DebitCredit: Option "",Debit,Credit;
    }
     
  • Suggested answer
    Aman Kakkar Profile Picture
    3,530 Super User 2026 Season 1 on at
    You’re right — the ValuesAllowed property can only be applied to custom fields you add in a table extension. It’s a restricted property, so you cannot use it to limit values on standard fields like Debit/Credit.

    For standard fields, you basically have two options:

    1. Create a custom field (that Suresh has already mentioned), hide the standard field on the page, and sync values back to the base field through validation logic. This gives you full control but can feel a bit heavy.
    2. Add code logic on the page/table ext (for example in the OnBeforeValidate trigger) to block unwanted values. You can show a custom error to restrict what the user can select in the UI. This way, you don’t need to add new fields.
    modify("Debit/Credit")
    {
        trigger OnBeforeValidate()
        begin
            if Rec."Debit/Credit" = Rec."Debit/Credit"::Both then
              Error('Value %1 is not allowed here.', Rec."Debit/Credit");
        end;
    }

    So unfortunately, you can’t just use ValuesAllowed directly on existing fields — either of the above workarounds will be needed depending on how strict you want the restriction to be.

  • Suggested answer
    Rishabh Kanaskar Profile Picture
    6,227 Super User 2026 Season 1 on at
    Hi,
     
    You cannot directly remove or hide standard Option/Enum values in BC as they are defined in the base application. Standard properties like ValuesAllowed or OptionMembers only work on custom fields.
    For restricting usage of unwanted values, the common approaches are:
    > Page Extension with Validation – Keep the standard field, but add OnValidate or a page-level trigger to block selection of disallowed values (e.g., throw an error if "Both" is chosen).
    > Substitute Field Approach – Create a custom field with only the allowed values, replace the standard field on pages, and sync back to the base field via AL code. This is heavier, but ensures users never see invalid options.
    > UI Customization – Use personalization or profiles to hide fields completely and replace them with custom controls.
     
    Best practice: go with option 1 (validate/block disallowed values). It’s lighter, upgrade-safe, and avoids maintaining parallel fields unless you need strict UI enforcement.
     
    Thanks
    Rishabh
  • Suggested answer
    Pallavi Phade Profile Picture
    5,639 Super User 2026 Season 1 on at
     
    Would always recommend to create new field in case of visiblity wrt users of hiding one option . You can create new field and set options and set visibility on open-Page of Chart of Accounts based on users profile or condition .
     
    Standard Fields always have impact till end of Transactions . so not recommending to touch the standard fields
     
     
    Regards
    Pallavi Phade 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,140 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,362 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,216

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans