Skip to main content

Notifications

Announcements

No record found.

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

  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;
    }

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 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().

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans