Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to disable Enum element in AX 2012

Posted on by 2,432

Hi All,

How can I disable Enum element through x++.

For example, SalesStatus base enum has four elements (Open order, Invoiced, Cancelled, Delivered).  

11111111.PNG

I want to disable one of enum element when ever form opens.

Please let me how it can be done.

Thanks,

Raziq

*This post is locked for comments

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: How to disable Enum element in AX 2012

    In my AX, these values are also Russia-specific items and don't use any CW configuration key.

    If it was as you said, it still could be done in many ways and I already mentioned some. For example, you could use a custom configuration key or a custom enum (without those two elements).

  • Mohammad Raziq Ali Profile Picture
    Mohammad Raziq Ali 2,432 on at
    RE: How to disable Enum element in AX 2012

    Hi Martib,

    I would like to tell you about the problem we are facing. 

    Untitled-_2800_2_2900_.png

    This above form has two fields highlighted can be disabled through catch weight configuration key shown below. This will disable those radio buttons but will effect other functionality as well which we don't want.

    Untitled-_2800_2_2900_.png

    So, I want to disable these two radio buttons through code.

    Is it feasible?

    Thanks,

    Raziq

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: How to disable Enum element in AX 2012

    Your example is related to country-specific functionality. Namely these values are available only to Russian legal entities.

  • Mohammad Raziq Ali Profile Picture
    Mohammad Raziq Ali 2,432 on at
    RE: How to disable Enum element in AX 2012

    Hi martin,

    Is there any approach to disable enum element in below shown approach.

    They present in form but it is disabled. If I go with configuration key, it will disappeared.

    1273.Capture.PNG

    Thanks,

    Raziq

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: How to disable Enum element in AX 2012

    You have two fundamental choices:

    • You'll merely change how the field is displayed in some forms.
    • Or you'll actually disable the enum element, which obviously have much bigger impact than just on some display. SalesStatus is a good example of an enum you shouldn't meddle with.
      You could set a disabled configuration key to the enum element, but you would have to review all business logic related to it. It may be difficult and risky. Creating a new enum and field may be actually a better approach.

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