Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

How to disable Enum element in AX 2012

Posted on by 2,430

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

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User 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,430 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 225,783 Super User 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,430 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 225,783 Super User 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.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans