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

Passing params to SSRS report

(0) ShareShare
ReportReport
Posted on by 6,611
Hello:
I have code below attempting to call a modified WmsBillOfLading SSRS report. To make a long story short, there is print management override to get the default report, and I've added a button on the WMSBillOfLading form trying to call 'print'. My issue is, based on the selected BOL on WMSBillOfLading form, I'm not able to pass the value so in the report param dialog it shows the BOL Id selected.  I'm having to manually enter the BOL Id in order to run the report. 
 
 
[FormControlEventHandler(formControlStr(WMSBillOfLading, myBOLPrint), FormControlEventType::Clicked)]
public static void myBOLPrint_OnClicked(FormControl sender, FormControlEventArgs e)
{
SrsReportRunController controller = new SrsReportRunController();
SRSPrintDestinationSettings printSettings;
WMSBillOfLading lclwmsBOL;
 
controller.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesBOL).getDefaultReportFormat());
controller.parmLoadFromSysLastValue(false);
 
Args args;
args = sender.formRun().args();
lclwmsBOL = sender.formRun().dataSource().cursor();
args.record(WMSBillOfLading::findRecId(lclwmsBOL.RecId));
controller.parmArgs(args);
controller.parmShowDialog(true);
controller.startOperation();
}
  • Suggested answer
    GirishS Profile Picture
    27,845 Moderator on at
    Hi,
     
    You can override the prePromptModifyContract method on the controller class to set default value to the report parameter.
    On this method you can get the caller record using this.parmArgs().record() to get the caller record and then set the value to the contract class parm methods.
    Refer to the below blog.
     
    Thanks,
    Girish S.
     
  • bankk Profile Picture
    6,611 on at
    Hi Girish,
    The WMSBillOfLading report does not have a contract class which I can override. Per the code above, I do have the cursor to the WMSBillOfLading record but without a contract class and a parm method, is it possible to set the BOL value? Thank you.
  • Verified answer
    bankk Profile Picture
    6,611 on at
    Hi Girish,
    I went a different route and modified the query sending in my BOL#. It appears to be working so far. Thank you for your help!
     
    queryLocal      = controller.getFirstQuery();
    queryBuildDataSource = SysQuery::findOrCreateDataSource(queryLocal, tableNum(WMSBillOfLading));
    queryBuildDataSource.clearRanges();
    queryBuildRange = SysQuery::findOrCreateRange(queryBuildDataSource, fieldNum(WMSBillOfLading, BillOfLadingId));
    queryBuildRange.value(lclwmsBOL.BillOfLadingId);

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
Martin Dráb Profile Picture

Martin Dráb 445 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 309 Super User 2026 Season 2

#3
CU29091230-0 Profile Picture

CU29091230-0 192

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans