Friday, November 5, 2021

Dynamic SSRS report name in D365 F&O

 When there is a requirement to generate dynamic report name. For example when saving report, the report name should be appended with Customer ID, Invoice ID etc. To do this in the controller class we have to write code for parmDialogCaption() method shown below:-

 

class DemoController extends SrsReportRunController
{
 
    public void prePromptModifyContract()
    {
        ProjInvoiceJour              projInvoiceJour;
        DemoContract             contract;
        FormDataSource               fds;
        
        contract    = this.parmReportContract().parmRdpContract() as DemoController;
        projInvoiceJour = args.record();
        fds = args.record().dataSource();
        contract.parmProjInvoiceId(projInvoiceJour.ProjInvoiceId);  
    }

    public static client void main(Args args)
    {
        DemoController             demoController;
        ProjInvoiceJour              projInvoiceJour;
        demoController= new DemoController();
        demoController.parmArgs(args);
        demoController.parmReportName(ssrsReportStr(RAR_AmazonBillingReport, Report));
        demoController.parmShowDialog(false);
       
        demoController.parmReportContract().parmReportCaption("Project Invoice Report");
        
        projInvoiceJour = args.record();
        demoController.parmDialogCaption("Project Invoice Report" + "_"+ projInvoiceJour.ProjInvoiceId); // This will generate dynamic report name        
        demoController.startOperation();
    }


when you export the report in excel, pdf or csv, the report name will be appended with ProjInvoiceId.


Source: D365FO Technical Blog: Dynamic SSRS report name in D365 FnO (axd365focode.blogspot.com)

No comments:

Post a Comment