web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Default enum field to empty value

(0) ShareShare
ReportReport
Posted on by

while adding new record in my table the base enum doesnot change it remain and pop up the value male .my requirement is when i am creating a new record in my table it should show null records and i have to select the enum field .In this my enum field is gender.2477.Capture.PNG

*This post is locked for comments

  • Suggested answer
    Sohaib Cheema Profile Picture
    on at
    RE: Base enum related

    This is default behavior of Base Enumeration, as index 0 is defaulted for new record.

    If you want to achieve what you are looking for, you may add a third element in Base Enum, set third element as "Not Specified". Make sure to keep your element "Not Specified" with Int Value 0 so it will be defaulted as default vale.

    Note that existing Base Enum may be, being used at many other locations in AOT, so better would be creating a customized Base Enumeration.

  • Suggested answer
    reachnaidu Profile Picture
    on at
    RE: Base enum related

    override initValue method on the table and assign the enum value other than male or Female .. If you dont have any enum with empty string .. then you need to create a enum with empty lable and Enum value (3 ) to be other than male and female

    public void initValue()

    {

      // Enum field

       this.Field1 = Gender::EmptyGender;

       super();

    }

  • Martin Dráb Profile Picture
    on at
    RE: Base enum related

    May I ask you to provide more descriptive thread titles than "Base enum related", "Table related", "Query related" and so on? If you want to show that the question is related to something, you can use tags. But you still have to provide a meaningful title that distinguish your question from other questions related to base enums, for example.

    Fixing that takes time that we could use for answering your questions.

  • Suggested answer
    Samy123 Profile Picture
    on at
    RE: Default enum field to empty value

    I think one way to do it is to start your EnumValues from 1 instead of 0, like Male = 1, Female = 2

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans