Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Making an Enum Field Go Blank when User hits (CTRL+N)

Posted on by Microsoft Employee

Hi EveryOne,

I have an enum field in my table and that field is having values (None,A,B,C) respectively.

When I open the table and hit (CTRL+N) the enum field by default is selecting the value as (None).  But I want it to be go blank when I do the same (CTRL+N).  However Should be able to select values manually into the enum field.

Can Some body help me with the x++ code or steps by which I can Accomplish the scenario mentioned above.

with thanks & regards ,

Nishath Salman N.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    Thanks For your Great help Martin. :)))))))

    Great Job :)

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    Simply assign a value to the field of the active record, such as MyDatasource.MyEnumField = MyEnum::No;.

    If your question is answered, please mark the corresponding reply (replies) as the verified answer.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    One Last Question Martin Then I ll be done for the day.   I want to use initValue() method. Please provide me the code by which I can manually select any value from enum field into the combo box.

    Please do needful

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    If you want to display a different enum than what you want to store in the actual database field, an edit method may be a good solution.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    Since I have added an empty field it is holding three values ( 'Blank Space',Yes, No).

    But now I want it to hold just two values YES and NO.  However newly added blank Labeled element should also be there but should be displayed in the enum field combo box. Only YES or No should Pop Up ?.

    Is there any method to do it ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    Ok Martin Got it.  Thanks a lot Once Again  !!!!!!!!! :)

  • Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    No, not exactly the same things. Enum element labels are defined at design time and then used by AX kernel.

    You could use some workarounds, such as building the combobox control by yourself, but it doesn't look like a good idea.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    I got your strategy . It's working Perfectly .  Thanks a lot Martin.

    Just One More Question I would like to ask.   Is it possible to do the same by means of Code(X++).  I mean by making use any override methods ?

    Thank You :)

  • Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    I already gave you more than one solution and I don't know which one meets your requirements, because I don't know them.

    For example, open the enum in AOT and set Label property of the None element to an empty string.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making an Enum Field Go Blank when User hits (CTRL+N)

    Can you please give me bit more explanation. I am really sorry but very new to ax 2012.

    So it is not possible to make the enum field go blank when I hit (CTRL+N) ?.  

    If possible please give me some sample code ...

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