Hi Experts,
I am customizing a standard SSRS report in D365FO by extending LedgerJournalController.
Current behavior:
-
If no record is selected → report prints all records (standard behavior)
Requirement:
-
If a user selects a single record → report should print only that selected record
-
If no record is selected → report should print all records (standard behavior)
I am not using multi-select (MenuItem property MultiSelect = No).
class LedgerJournalController extends LedgerJournalController
{
public static LedgerJournalController construct()
{
return new LedgerJournalController();
}
{
LedgerJournalController controller = LedgerJournalController::construct();
controller.parmArgs(_args);
MainAccount tpo_MainAccount;
if(DevelopmentParameters::find().MainAccBlockingInGL)
{
while select * from MainAccount where MainAccount.MainAccount == "1913"
{
if(MainAccount.UserId != curExt())
{
controller.parmReportName(ssrsReportStr(LedgerJournal, ReportNew));
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(true);
controller.startOperation();
}
else
{
controller.parmReportName(ssrsReportStr(LedgerJournal, Report));
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(true);
controller.startOperation();
}
}
}
else
{
controller.parmReportName(ssrsReportStr(LedgerJournal, Report));
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(true);
controller.startOperation();
}
}
{
super();
{
LedgerJournalTable journalTable = _args.record();
QueryBuildDataSource qbds = query.dataSourceTable(tableNum(LedgerJournalTable));
.value(queryValue(journalTable.RecId));
}
}
I tried using _args.record() and applying a filter on LedgerJournalTable.RecId using QueryBuildDataSource, but the report still returns all records.
It seems that setRange() is not respecting the selected record from the form.
What is the correct way to pass the selected record from the form to the SSRS report query when using LedgerJournalController?
Should the filtering:
- Be applied in the controller by modifying the query before calling
setRange()? - Or be handled in the Data Provider (DP) class using a contract parameter?
Also, is setRange() sufficient for handling selected records, or do I need to override the query differently?
Additional Info:
- Menu item: MultiSelect = No
- Report works correctly for full dataset
- Requirement is only single record selection

Report
All responses (
Answers (