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

Announcements

No record found.

News and Announcements icon
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

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    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.

  • Community Member Profile Picture
    on at

    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
    André Arnaud de Calavon Profile Picture
    305,194 Super User 2026 Season 1 on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 34

#1
CP04-islander Profile Picture

CP04-islander 34

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans