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

Enum use

(3) ShareShare
ReportReport
Posted on by 57
I have one Field Interview Rounds in my table that have datatype Enum 
 
field(5; "interview_rounds"; Enum "Interview Rounds Enum")
        {
            Caption = 'Interview Rounds';
 
        }
 
enum 50100 "Interview Rounds Enum"
{
    Extensible = true;
 
    value(0; "Initial Screening") { }
    value(1; "Technical Round") { }
    value(2; "HR Round") { }
    value(3; "Final Discussion") { }
    value(4; "Finance Review") { }
    value(5; "Sales Pitch") { }
    value(6; "Marketing Strategy Discussion") { }
    value(7; "Project Planning Assessment") { }
    value(8; "Client Handling Assessment") { }
    value(9; "Administrative Tasks Review") { }
    value(10; "Reception & Communication Skills") { }
 

Now I want to display options according to the designation name in interview rounds field but 
 trigger OnAfterGetRecord()
    var
        interview_enum: Enum "Interview Rounds Enum";
    begin
        case Rec.designation_name of
            'Sales Manager':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Sales Pitch";
                    Rec.interview_rounds := interview_enum::"Final Discussion";
 
                end;
 
            'Marketing Manager':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Marketing Strategy Discussion";
                    Rec.interview_rounds := interview_enum::"Final Discussion";
                end;
            'Financial Analyst':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Finance Review";
                    Rec.interview_rounds := interview_enum::"Final Discussion";
                end;
            'Project Manager':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Project Planning Assessment";
                    Rec.interview_rounds := interview_enum::"Final Discussion";
                end;
            'Account Executive':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Client Handling Assessment";
                    Rec.interview_rounds := interview_enum::"HR Round";
                end;
            'Administrative Assistant':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Administrative Tasks Review";
                    Rec.interview_rounds := interview_enum::"HR Round";
                end;
            'Receptionist':
                begin
                    Rec.interview_rounds := interview_enum::"Initial Screening";
                    Rec.interview_rounds := interview_enum::"Reception & Communication Skills";
                    Rec.interview_rounds := interview_enum::"HR Round";
                end;
 
        end;
    end;

 
but it show all for example if designation is sales manager then "Initial Screening,"Sales Pitch","Final Discussion" only these can display and so on so please help me out to get this solution asap
  • Vahid Ghafarpour Profile Picture
    11,453 Super User 2025 Season 1 on at
    Enum use

    If any of the responses helped resolve your issue, please take a moment to mark the best answer. This helps others in the community quickly find solutions to similar problems.

    To do this, simply click the "Does this answer your question?" button on the most helpful response and like the helpful posts. If your issue is still unresolved, feel free to provide more details so the community can assist further!

    Thanks for being an active part of the Dynamics 365 Community! 😊

     

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    16,318 Super User 2025 Season 1 on at
    Enum use

    Enums in Business Central can’t be filtered dynamically based on another field like designation_name, so your current approach won't work as intended. Instead, replace the Enum with a lookup to a custom table (e.g., "Interview Round Setup") that stores allowed interview rounds per designation. Then, use a TableRelation on your field to filter rounds by designation—this way, only the relevant rounds will show based on the selected designation
     

  • Gerardo Rentería García Profile Picture
    18,643 Most Valuable Professional on at
    Enum use

    Hi, good day
    I hope this can help you, and give you some hints.

    Dynamics 365 Business Central: Hiding enum values on the page (ValuesAllowed Property) | Dynamics 365 Lab

    Best Regards
    Gerardo

  • TK-02040743-0 Profile Picture
    57 on at
    Enum use
    Yes I agree but Provide me Solution If you have Related my Question of Enum
  • Martin Dráb Profile Picture
    233,354 Most Valuable Professional on at
    Enum use
    I moved from Integration, Dataverse, and general topics forum to Small and medium business | Business Central, NAV, RMS forum, because it seems to be about Business Central. Please let me know if you disagree.
  • TK-02040743-0 Profile Picture
    57 on at
    Enum use
        Rec.FilterEnumField("interview_rounds", TempEnumOptions);
    This is not a Proper property it cannot be used directly so provide me alternate solution
  • Holly Huffman Profile Picture
    6,078 on at
    Enum use
    Good morning, afternoon, or evening - depending on your location :)
    Hope you are well today!
     
    To ensure only relevant interview rounds are displayed based on the designation_name, you need to filter the options dynamically when interacting with the Interview Rounds field. The issue is occurring because the code snippet you provided assigns multiple values to the field Rec.interview_rounds, which is not the correct approach for filtering dropdown options.
     
    See below revised:
    Key Changes:
    1. Use Temporary Variables for Filtering: Create a temporary list or array to hold the filtered Enum values dynamically based on the designation_name.
    2. Adjust Field Behavior: Override the dropdown display logic for the Interview Rounds field.
    Suggested Solution:
    trigger OnAfterGetRecord()
    var
        interview_enum: Enum "Interview Rounds Enum";
        TempEnumOptions: Text[250];
    begin
        TempEnumOptions := ''; // Initialize temporary variable for filtered options.

    case Rec.designation_name of
            'Sales Manager':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Sales Pitch", interview_enum::"Final Discussion");
                end;
            'Marketing Manager':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Marketing Strategy Discussion", interview_enum::"Final Discussion");
                end;
            'Financial Analyst':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Finance Review", interview_enum::"Final Discussion");
                end;
            'Project Manager':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Project Planning Assessment", interview_enum::"Final Discussion");
                end;
            'Account Executive':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Client Handling Assessment", interview_enum::"HR Round");
                end;
            'Administrative Assistant':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Administrative Tasks Review", interview_enum::"HR Round");
                end;
            'Receptionist':
                begin
                    TempEnumOptions := StrSubstNo('%1,%2,%3', interview_enum::"Initial Screening", interview_enum::"Reception & Communication Skills", interview_enum::"HR Round");
                end;
        end;

    // Apply filtered options to Interview Rounds field.
        Rec.FilterEnumField("interview_rounds", TempEnumOptions);
    end;

    Explanation of Changes:
    1. Temporary List for Enum Options: A dynamic list (TempEnumOptions) is built using filtered values based on the designation_name.
    2. Dynamic Filtering: The Rec.FilterEnumField method (or equivalent in your version of AL/D365) applies this filtered list to the field's dropdown options.
    3. Display Only Relevant Options: The dropdown now displays options specific to the designation, preventing all Enum values from being shown.
     
    Hope this helps :)

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

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

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 428 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 295

#3
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 276

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans