Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Disable a class from use through any feature like configuration keys

(1) ShareShare
ReportReport
Posted on by

Hello there,

I am currently sitting on a problem where I need to disable a class from use. I would like this to be done by configuration keys, since it probably would be the easiest way, but sadly there's no option for classes to have configuration keys.

The class' code should not be usable/runnable when the "configuration key" is disabled, e.g. if a table method calls a static method on a 'disabled' class, I want it to return an error. I know limiting access to classes ran by menu items is quiet possible with privileges, duties and process cycles as well as code permissions, but that's not quiet what I'm looking for.

Thank you in advance for any help and kind regards!

*This post is locked for comments

  • Verified answer
    André Arnaud de Calavon Profile Picture
    294,791 Super User 2025 Season 1 on at
    RE: Disable a class from use through any feature like configuration keys

    Hi Niklas,

    Normal AX users don't need additional rights for this x++ statement. This statement is used throughout the system. Note that all users should have at least the system user role for one, more or all legal entities.

    So try Martins suggestion.

  • Community Member Profile Picture
    on at
    RE: Disable a class from use through any feature like configuration keys

    Thanks for your answer Martin! As far as I know, the method "isConfigurationKeyEnabled" requires specific rights from a user to be executed, thus a common AX user wouldn't be able to 'execute' a method including that specific method.

    Am I wrong?

  • Verified answer
    Martin Dráb Profile Picture
    233,573 Most Valuable Professional on at
    RE: Disable a class from use through any feature like configuration keys

    If you want your method to throw an error, you can do it, of course. It seems that you're question should be "How can I check from code that a configuration key is disabled, so I can conditionally throw an error?"

    The answer is: use isConfigurationKeyEnabled(). By the way, use configurationKeyNum() to convert configuration key names to IDs.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans