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

Enum use

(3) ShareShare
ReportReport
Posted on by 61
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
I have the same question (0)
  • Holly Huffman Profile Picture
    6,538 Super User 2025 Season 2 on at
    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 :)
  • TK-02040743-0 Profile Picture
    61 on at
        Rec.FilterEnumField("interview_rounds", TempEnumOptions);
    This is not a Proper property it cannot be used directly so provide me alternate solution
  • Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at
    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
    61 on at
    Yes I agree but Provide me Solution If you have Related my Question of Enum
  • Gerardo Rentería García Profile Picture
    25,390 Most Valuable Professional on at

    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

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,962 Super User 2025 Season 2 on at

    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
     

  • Vahid Ghafarpour Profile Picture
    12,202 Super User 2025 Season 2 on at

    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! 😊

     

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 2,116

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 764 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 635 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans