web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,807 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
    300,917 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans