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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to pass value to the ER report using query to filter the records from x++ code

(3) ShareShare
ReportReport
Posted on by 489
Hi All,
I have a requirement to call an ER report, read the generated XML, and then create another XML in a different format from it.
We are currently stuck on passing parameter values to the report because the report parameters are designed based on a query.

Could you please advise if there is a way to retrieve that query and pass the values accordingly? 

we have tried by creating contract and adding that contract in the model design but that is not working.

Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,632 Most Valuable Professional on at
    You can pass parameters to ER from code. Let me give you two examples from the standard application:
     
    Using a query:
    ERIModelDefinitionParamsUIAction parameters = new ERModelDefinitionDatabaseContext().addQuery(tablenum(PayrollPositivePayExportEntity), _query);
    Filename filename = strFmt('%1-%2', bankPositivePayTable.PayFormat, bankPositivePayTable.PositivePayNum);
    str outputFileName = ERObjectsFactory::createFormatMappingRunByFormatMappingId(_eRFormatMappingId, filename)
            .withParameter(parameters)
            .run();
    A temporary table buffer and a contract object:
    ERIModelDefinitionParamsAction parameters = new ERModelDefinitionParamsUIActionComposite()
        .add(new ERModelDefinitionDatabaseContext().addTemporaryTable(assetBookCompareTmp))
        .add(new ERModelDefinitionObjectParameterAction(ERModelDataSourceName, 'AssetBookCompareParameters', _contract, true));
    
    // Call ER to generate the report.
    ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId, DefaultExportedFileName)
        .withParameter(parameters)
        .withFileDestination(_contract.getFileDestination())
        .run();

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 804

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 639 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 528

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans