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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

use internal class in your customized module

(0) ShareShare
ReportReport
Posted on by

I have a case where I need to call the the following line of code in a class in my customized module :

HcmFeatureStateProvider::isFeatureEnabled(HRUserExperienceFeature::instance());

I face the following error : The method 'instance' contained in the non-public class 'HRUserExperienceFeature' is inaccessible. 

I notice that the class is defined  in Human resources  platform module and it is called in a form exists in personnel management module . How can I can I call this method similar to  the case I notice in the standard code 

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at

    You can't. The whole point of using an internal keyword is preventing code in other packages to use such a method. You'll need to look for a different solution.

    Because this question is clearly about F&O, I'm going to move it from Dynamics AX Forum to Dynamics 365 Finance Forum.

  • maram fraij Profile Picture
    on at

    How the standard calls this class from another module even it is internal 

  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at

    Where do you see such a call?

  • maram fraij Profile Picture
    on at

    In the form (HcmWorkerNewWorker) exists in module (Personnel management ) , we have the following line of code in the body of the class

    private boolean isHRUserExperienceFeatureEnabled = HcmFeatureStateProvider::isFeatureEnabled(HRUserExperienceFeature::instance());

    Both class (HcmFeatureStateProvider) and class (HRUserExperienceFeature) are in module (Human resources plat form ) and both they are defined as internal

  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at

    This is a special case. If you look at parameters of Human Resources Platform model, you'll see that it states PersonnelManagement as a "friend" package. It means that it allows PersonnelManagement to use its internal members.

    It won't help you, because you aren't allowed to change configuration of Microsoft packages.

  • maram fraij Profile Picture
    on at

    I am thinking about creating a new customized package inside personnel management package but I cannot find it , do you have an idea ?

    3108.Untitled.png

  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at

    This isn't possible. You aren't allowed to change PersonnelManagement package. Only Microsoft could do it.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans