Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Passing params to SSRS report

(0) ShareShare
ReportReport
Posted on by 6,603
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();
}
  • Verified answer
    bankk Profile Picture
    bankk 6,603 on at
    Passing params to SSRS report
    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);
  • bankk Profile Picture
    bankk 6,603 on at
    Passing params to SSRS report
    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.
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Passing params to SSRS report
    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.
     

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans