Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Hiding enum values

Posted on by 142

Hi, all

I would like to hide some values of enum in comboBox control, called enumControl. I've written the following code inside init method before super.

Set enumSet = new Set(Types::Enum);
enumSet.add(MyEnum::Value1);
enumSet.add(MyEnum::Value2);
sysFormEnumComboBox = SysFormEnumComboBox::newParameters(element,
element.controlId(formControlStr(MyForm, enumControl)),
enumNum(MyEnum),
enumSet);

But it does not works for me well. There are some redundant values.

Do you have any ideas what I can miss?

Thanks in advance.

*This post is locked for comments

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    Vishal Dhavgaye 405 on at
    RE: Hiding enum values

    Please review your solution. I believe in this case its better to create setup/configuration table for more flexibility. You have better control on data.

  • Tony Mok Profile Picture
    Tony Mok 577 on at
    RE: Hiding enum values

    Hi Khashayar,

    The control should be unbound(no field on control).

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Hiding enum values

    Hidden developer, did You solve your Problem ?

  • Hidden developer Profile Picture
    Hidden developer 142 on at
    RE: Hiding enum values

    Oh, it is great. Thank you)

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Hiding enum values

    Hi Hidden developer,

    enumControl should not be bound to a datasource field. Please check in control properties that datasource field property is empty.

    Also you need to override modified method to save selected value to a field, please refer for details exploreax.wordpress.com/.../axtechnicald1

  • Hidden developer Profile Picture
    Hidden developer 142 on at
    RE: Hiding enum values

    I expect that enumControl will have only Value1 and Value2 values

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans