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 :
Microsoft Dynamics AX (Archived)

Reorder base enum elements in combo box control.

(1) ShareShare
ReportReport
Posted on by

Hi,

I have to add an additional element to the WrkCtrType base enum . I do that, but when I select the new element I noticed that the value stored in the table field is not correct. I began to investigate the problem and found that there is a method which iterate over the base enum elements. It removes an element based on a condition.

The method:

public static void limitComboToIndividualResourceTypes(FormComboBoxControl _comboBox)
{
    DictEnum dictEnum = new DictEnum(enumNum(WrkCtrType));
    int      i;

    _comboBox.clear();

    for (i=0;i<dictEnum.values();i++)
    {
        if (dictEnum.index2Value(i) != WrkCtrType::Group)
        {
            _comboBox.add(dictEnum.index2Label(i));
        }
    }

    _comboBox.update();
}


 The Base Enum:

8737.enum.png

As you can see the method first clear the combobox list and puts all elements except element numer 5 (Group).

combobox.add(...) just add a string value to the combobox list starting from position 0. An element "Group" meets the condition, so it is not included to the list. The next element (NewElement) gets position 6 (not 7). This is the reason that the value stored in the table field is not correct.

How this problem can be solved? Some workaround?

Thanks,

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,194 Super User 2025 Season 2 on at

    Hi Jaret,

    What is the enum value according to the property in the base enum?

  • Community Member Profile Picture
    on at

    Hi Andre,

    The value is 50.

    Best Regards,

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Jaret,

    You probably want to read this blog community.dynamics.com/.../how-to-add-enum-filter-with-all-element

    There you can find example how you can use map to map combobox values to enum values.

  • André Arnaud de Calavon Profile Picture
    301,194 Super User 2025 Season 2 on at

    Hi Jaret,

    What label is shown on the form? Is this correct? When I look at the coding this part should work. Where exactly do you see wrong values?

    If you temporary try to disable this method, would that cause to have the correct value in the database? In this case all options, also the group, would be visible.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans