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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Error-The constructor for class 'EcoResReleasedProductV2EntityToCrssTableDataAdaptor' is not visible in this context due to the protection level of the class.

(0) ShareShare
ReportReport
Posted on by 2

  private EcoResReleasedProductV2EntityToCrossTableDataAdaptor crossTableDataAdaptor()
    {
        return EcoResReleasedProductV2EntityToCrossTableDataAdaptor::newFromEntity(this);
    }

here newfromentity method is being called from an AOT class  and have two methods with parameter EcoResEntity but i wanted here my parameter i.e OABEcoresEntity but this error is coming , i have duplicate this class and added my parameter

  public static EcoResReleasedProductV2EntityToCrossTableDataAdaptor construct()
    {
        return new EcoResReleasedProductV2EntityToCrossTableDataAdaptor();
    }

    public static EcoResReleasedProductV2EntityToCrossTableDataAdaptor newFromEntity(EcoResReleasedProductV2Entity _releasedProductEntity)
    {
        var adaptor = new EcoResReleasedProductV2EntityToCrossTableDataAdaptor();
        adaptor.initFromEntity(_releasedProductEntity);
        return adaptor;
    }

I have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Error-The constructor for class 'EcoResReleasedProductV2EntityToCrssTableDataAdaptor' is not visible in this context due to the protection level of the class.

    Hi sachin mittal,

    After duplicating the class you need to replace the standard class name with your custom class name.

    Seems in the code you are using standard class in construct method and also in newFromEntity method.

    Thanks,

    Girish S.

  • Verified answer
    Martin Dráb Profile Picture
    236,863 Most Valuable Professional on at
    RE: Error-The constructor for class 'EcoResReleasedProductV2EntityToCrssTableDataAdaptor' is not visible in this context due to the protection level of the class.

    You can't call the constructor of EcoResReleasedProductV2EntityToCrossTableDataAdaptor class (new EcoResReleasedProductV2EntityToCrossTableDataAdaptor()), because it's protected and therefore it can be called only from EcoResReleasedProductV2EntityToCrossTableDataAdaptor class itself or its children.

    If you open EcoResReleasedProductV2EntityToCrossTableDataAdaptor class, you'll notice that new() is protected, but there is a public factory method called construct(). That's the usual pattern in AX/F&O.

    Therefore you should replace new EcoResReleasedProductV2EntityToCrossTableDataAdaptor() with EcoResReleasedProductV2EntityToCrossTableDataAdaptor::construct().

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 636

#3
Martin Dráb Profile Picture

Martin Dráb 553 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans