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

Passing params to SSRS report

(0) ShareShare
ReportReport
Posted on by 6,609
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();
}
I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 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,609 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,609 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

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans