Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

BaseEnums - Restrictions

Posted on by Microsoft Employee

Hi Community,

I have two BaseEnums:

-VehicleType
-VehicleCategorie

VehicleType:

1 Car

2 Truck

VehicleCategorie

1 small

2 midrange

3 compact

4 Truck Class 1

5 Truck Class 2

6 Truck Class 3

I have a priceTable with Fields : CarTyp, CarCategorie, Model & Price.

Now I want to make a restrictions. Like if I choose for CarType: "Car" only the first 3 values(Options) from CarCategorie shall be shown to me.

And for "truck" the last three shall be shown.

Any Suggestions where I could start ?

I thought maybe starting in the validateField() method. Based on the selection I make for my CarType I could say in validateField() that only Categories are allowed which match to that CarType.

Or could I use Conditional Table Relations ?

*This post is locked for comments

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: BaseEnums - Restrictions

    Comboboxcontrolid variable should have a proper value, because you getting grid control  that does not have enum type method.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: BaseEnums - Restrictions

    I am interested in your second recommnedation, because it is something I think I can learn from and it is new to me.

    I wrote almost the same Code but unfortunately everytime I run, the Debugger Pops up.

    SysFormEnumComboBox2.PNG

    SysFormEnumComboBox2.PNG

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: BaseEnums - Restrictions

    Hi Khashayar,

    validateField is a good start, there you can check that VehicleCategorie type and return true if it is valid or return false and show warning message to user if it is not. However, if you want to hide values of VehicleCategorie from selection base on VehicleType you can use sysFormEnumComboBox, please refer for details https://community.dynamics.com/ax/b/axdevhelp/archive/2012/08/27/hide-enum-values-in-form-control

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans