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

The method 'CreateLogger' contained in the non-public class 'InventInstrumentationLogger' is inaccessible

(0) ShareShare
ReportReport
Posted on by 55

Hi Experts,

i have created a duplicate class for InventCountCreate  that means i copied all the code in my new class(i will attach this new class to my menu item) .

i'm, getting errors while compiling like below.

The method 'CreateLogger' contained in the non-public class 'InventInstrumentationLogger' is inaccessible

i have referenced model Applicationsuite in my customized model (Model parameters).

Could you please help how can i resolve these issues.

Thanks,

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

    InventInstrumentationLogger is an internal class, therefore it can be accessed only from the package where it's defined. It can't be accessed from your model/package.

    If you wish, you can duplicate InventInstrumentationLogger class as well (and then potenially InventInstrumentationLoggerProperties too).

    But do you really have to duplicate InventCountCreate? Couldn't you use inheritance? Then you would inherit all the logic, including the one dealing with InventInstrumentationLogger.

  • Koti9999 Profile Picture
    55 on at

    Thank you Martin for the response !!

    Actually I need to write my own logic or remove filters in one of the private method in the inventcreate class addquerySiteAndLocationFilters(). And the rest code should be as it is in the class.

    As I can't create coc or eventhandler for private method and all the code should be executed as it is in the class.im trying to create duplicate class so that I can modify the private method in my duplicate class.

    Note : there is no options to create coc after the private method execution to override the logic.

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

    I'm sorry, but I don't see addQuerySiteAndLocationFilters().

  • Koti9999 Profile Picture
    55 on at

    This is the method.

    inventCountCreate.queryAddSiteAndLocationFilter();

    pastedimage1637849168895v1.png

    let me show my actual issue.

    while  i'm creating onhand invent counting journal.warehouse displaying values twice.

    pastedimage1637849274339v2.png

    See the Warehouse displaying twice.

    pastedimage1637849331698v3.png

  • Koti9999 Profile Picture
    55 on at

    Hi Experts.

    Any thoughts or suggestions on the above issue.

    Thanks

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

    Aha, so it's queryAddSiteAndLocationFilter(), not addQuerySiteAndLocationFilters().

    I don't understand your business problem, but if you want to skip queryAddSiteAndLocationFilter(), isn't the easiest solution not to call main() at all? Create a new static method via CoC, put the necessary logic there and call this method instead of main(). It's easier than deplicating the whole class and it'll cause less issues with maintainability.

  • Koti9999 Profile Picture
    55 on at

    But the class inventcountcteate is attached to menu action item.by default main method is the entry for the class.

    Isn't it?

    Can I write coc for main method?is it possible?

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

    If you're happy to create a completely new class, then you want be using the existing menu item, right? If so, it's this menu item is irrelevant and we don't need to talk about it.

    Yes, if you need to call your class by a menu item, the class requires main() method. From there you can call the new method suggested above.

    You can use CoC on static method such as main(), but it doesn't seem to be something you should do in this case.

  • ergun sahin Profile Picture
    8,826 Moderator on at

    I agree with Martin. I haven't looked through the code, but since you're thinking of copying inventCountCreate, you can change where main is called.

    Call your own method instead of Main and you call the corrected copy of queryAddSiteAndLocationFilter in it.

    Since you will be use the Class extension, other structures will work as before.

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans