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, ...
Answered

How to use internal classes in "my model"?

(0) ShareShare
ReportReport
Posted on by

Hello,

I would like to run the electronic report from my form.

For that I have created a class and tried to use ERFormatMappingRun class, which is used to run electronic reports.

Compilation gives below error:

Class 'ERFormatMappingRun' is internal and is not accessible from the current module 'MyModel'

I understand, that it can be only used within it's own model, but what are the workaround to use internal classes' logic from my model?

Thanks.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Internal classes can used only in the package where they are defined.

    There is no workaround to use them.

    But, there can be ways to solve your business requirement, which don't require you to call those classes from your code.

    Could you share your business requirement?

  • DAX Dev Profile Picture
    on at

    We have created an electronic report for transfer orders, which generates the excel file.

    The requirement is to have a menu item on Transfer orders which will execute that electronic report.

    We have a parameter which points to the ER configuration.

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You can't use the internal class ERFormatMappingRun, but you can use the public interface ERIFormatMappingRun. Use ERObjectFactory::createFormatMappingRunByFormatMappingId(), for example, to create an instance of the interface.

    You'll find a plenty of examples in the standard application. This one is from EuSalesListReportingEngine.generateFile():

    ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId, _filename)
        .withFileDestination(fileDestination)
        .withParameter(new ERModelDefinitionDatabaseContext()
            .addQuery(tablenum(EUSalesListReportingGroup), salesListERQuery)).run();

  • DAX Dev Profile Picture
    on at

    Hello Martin,

    I was able to generate the file using similar approach. As I understand by testing, we need to have Electronic reporting destination --> Destination settings --> File enabled, in order the file to be automatically downloaded. So, I have set it enabled and file is generated and downloaded.

    We want to apply little bit different logic during "Ship transfer order" process.

    During this process file must be sent toa predefined E-mail address.

    Wat would be a best approach? Should I create another file destination setting for e-mail? If I enable both "File" and "Email" in the same settings, I could not find the way how to differentiate them (e.g. Use "File" when executed from new menu item. Use "E-mail" when executed during shipping)

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi DAX Dev,

    seems like your original question is answered. Would you mind creating a new discussion for your new question (and marking the helpful answer(s) here as verified)? Thanks!

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans