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

How to pass query filter in Electronic reporting from source code

(0) ShareShare
ReportReport
Posted on by 71

I have created a custom Export format for bank integration. I need to call ER report from the code and pass the query filter before calling run method. I don't have user input parameters since I am using a query to filter records.

I am stuck on the code on how to pass the value before calling the run method. I have followed this document to pass the value but it is not working coz I don't have a user input parameter and gets into an exception.

This is what I am passing 

pastedimage1678961419971v1.png

When i run the report from ER

 pastedimage1678961534231v2.png

This is where the system throws exception

pastedimage1678961692840v3.png

I have the same question (0)
  • Verified answer
    Arcadi  Profile Picture
    796 on at

    Hi Hammad, add your user input of type sstring in the root of your model mapping (center column", call it "XYZ" and pass it in code as "model/XYZ"

  • Hammad Khan Profile Picture
    71 on at

    Hi Arcadi Burria,

    Thanks for the reply. Your comment partially answered my query so I am marking it as an answer

    For those who are facing a similar situation, this is what I did to make it work


    • First, edit and disable ask for query on data source 
      pastedimage1679566813213v2.png
    • Add a user input parameter  JournalNum in my case
    • Add the calculated field and in the formula, section add the filter function and link to a user input parameter 
      pastedimage1679566991547v3.png
    • As mentioned by Arcadi Add the string type field in the data model and bind it to your user input parameter
      pastedimage1679567137952v4.png
    • In code pass your parameter as Model/journalNum  
         const str   erParmJournalNum    = "Model/JournalNum;
                  str         todayDate           = date2str(today(), 123, DateDay::Digits2,DateSeparator::None,DateMonth::Digits2,DateSeparator::None,DateYear::Digits4);
                  FileName    downloadfileName    = "your download file name";
                  ERIFormatMappingRun             ERIFormatMappingRun;
      
                  // Add the input parameter – journal num so that it export the lines only for that journal
                  ERModelDefinitionInputParametersAction modelDefinitionInputParametersAction = new ERModelDefinitionInputParametersAction();
                  modelDefinitionInputParametersAction.addParameter(erParmJournalNum, _journalNum);
                  
                  // attach the file to attachments in journal header
                  Var fileDestination = ERObjectsFactory::createFileDestinationAttachmentWithOtherDocuType("table that your want your attachemnt to attach to");
                  // Export the data in the file based on the input parameters
                  ERIFormatMappingRun = ERObjectsFactory::createFormatMappingRunByFormatMappingId(your format recid, downloadfileName);
                  ERIFormatMappingRun.withParameter(modelDefinitionInputParametersAction);
                  ERIFormatMappingRun.parmShowPromptDialog(false);
                  ERIFormatMappingRun.withFileDestination(fileDestination);
                  ERIFormatMappingRun.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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 470

#3
Adis Profile Picture

Adis 270 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans