Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

ValuesAllowed (field) Property

Posted on by 60

Community,

I've seen that the ValuesAllowed Property is Non-Customizable.

Has anyone found an effective workaround to this limitation?

I was hoping to use this to filter a list of ENUM choices based on user selections made elsewhere.

It'd be nice to be able to manipulate this like the VISIBLE Property, for which we can have it match a Boolean elsewhere (I know that ValuesAllowed isn't boolean).

Thanks,

Anthony

  • antmas Profile Picture
    antmas 60 on at
    RE: ValuesAllowed (field) Property

    Muaaz,

    Thanks for the suggestion.

    Perhaps I am missing something, but I don't see where the allowable selections become dynamic.

    Based on the docs and multiple replies, it doesn't seem doable.

    Thanks for the suggestion.

    -Anthony

  • antmas Profile Picture
    antmas 60 on at
    RE: ValuesAllowed (field) Property

    ZHU,

    This seems like wise advice, and I will consider it if I cannot find another way to accomplish the same goal.

    Thanks again,

    Anthony

  • Verified answer
    Muaaz Deyab Profile Picture
    Muaaz Deyab 184 on at
    RE: ValuesAllowed (field) Property

    I think you can create new Enum and field and map them to the original ones like This:

    enum 90000 MyEnum

    {    /// create enum with the same values of the original One

       Extensible = true;

       value(0; MyValue)

       {

       }

       value(1; MyValue1)

       {

       }

       value(2; MyValue2)

       {

       }

    }

    tableextension 90000 MyExtension extends Customer

    {

       fields

       {

           field(90000; MyField; Enum MyEnum)

           {

               DataClassification = ToBeClassified;

               ValuesAllowed = 1, 2;  // add the allowed values here

               trigger OnValidate()

               var

                   myInt: Integer;

               begin

                   rec.Validate("original Field", MyField);   // validate the original field  

               end;

           }

       }

       var

           myInt: Integer;

    }

    I don't know if it is a good solution, just trying to help.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 68,664 Super User 2024 Season 2 on at
    RE: ValuesAllowed (field) Property

    Hi, If there are too many values in your Enum, I suggest not to use the Enum type, but consider creating a table to manage them. In this way, more things can be done in permission or code.

    Hope this helps.

    Thanks.

    ZHU

  • antmas Profile Picture
    antmas 60 on at
    RE: ValuesAllowed (field) Property

    ZHU,

    Before posting my question, I did consider your method (saw it in a separate post / answer).

    That seems like a good solution for some cases.

    However, in my situation, there are too many possible Enum outcomes to make a field for each.

    Thanks as always for the thoughtful reply,

    Anthony

  • Nitin Verma Profile Picture
    Nitin Verma 20,995 Moderator on at
    RE: ValuesAllowed (field) Property

    Hi,

    This is property not available to customize, you can customize your solution to achieve the requirement.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 68,664 Super User 2024 Season 2 on at
    RE: ValuesAllowed (field) Property

    Hi, The only solution now is to add repeated Enum fields on the page, then set different ValuesAllowed Properties for them, and then control which value is displayed through the conditions of the Visible property. . . It's a little troublesome. . . .

    pastedimage1676939771139v1.png

    Hope this helps.

    Thanks.

    ZHU

  • DAnny3211 Profile Picture
    DAnny3211 9,215 Moderator on at
    RE: ValuesAllowed (field) Property

    hi

    it's non-customizable

    learn.microsoft.com/.../devenv-valuesallowed-property

    DAniele

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans