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)

How to remove particular enum from a drop drop?

(0) ShareShare
ReportReport
Posted on by 40

Hi Everyone,

We have a requirement to show a relevant enum values to the User. if we try to delete it, it is messing up with the index values. Is there a way possible that we can remove enum value without creating a new enum or a field for the same and without messing up with the index values? 

Regards,

Sumeet

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    dynamics developer Profile Picture
    2 on at

    Hi,

    checkout this post. I would use the suggestion from the last answer since we don't want to mess with the enum integer values

    i.e. use a balnk combo box control on the form and fill only the required values from the original enum. then map the value to the actual enum field on the table.

  • Sumeet Kaushal Profile Picture
    40 on at

    Hi Haris,

    Thanks for writing in. I have tried this already by taking a combo box whatever we are assigning is reflecting everywhere in the form and its is correctly inserting the value. But the problem is

    Lets suppose i have enum ABC with elements A, B, C

    if i create a combo box control with these values and i selected element B and on the modified method i have assigned it to the mapped field. however in the combobox value it is reflecting B everywhere if i am going to the next row.

  • Suggested answer
    dynamics developer Profile Picture
    2 on at

    Hi Sumeet,

    I checked and it really fills up all the controls with the latest assigned value. Maybe because we are not storing the value in any field as the control is not linked to one. I don't know how to solve this but there is another way in which u can achieve this.

    By using a sample table with one string field and fill it up on the form's init method with the desired enum values. Then perform a lookup on that control for that table. you will need another field on the table to save the selected enum's value and also do the mapping to the actual enum. A sample code for init method would be

    //Form's init method
    public void init()
    {
        int a;
        TestLookupTmp   testTbl;
        super();
        
        delete_from testTbl;   //clear the table so it doesn't duplicate values
    
        for (a = 1 ; a <= 5 ; a++)
        {
            testTbl.lookup = int2str(a);  //insert your desired enum values
            testTbl.insert();
        }
    }
  • Suggested answer
    Sumeet Kaushal Profile Picture
    40 on at

    In the list and details page i used this. Apart from it i wrote some code in the active method so it displays only what is stored actually in the field and it works. Now problem is with if we have to show on grid then how we gonna achieve it without creating table or field. Thanks Adil!

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