AX / D365FO – Execute a SSRS report in batch mode

If you have a report that takes a long time to complete you can consider running it in “batch mode”

To reach this result you must call the parmExecutionMode(SysOperationExecutionMode::ScheduledBatch) method in the main Method of the report controller class.

For example you can do this

public static void main(Args _args)
{
   TaxReportController_IT  controller = new TaxReportController_IT();
   controller.parmReportName(ssrsReportStr(TaxReport_IT, Report));
   
   controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch); //This executes the report run in Batch mode
   
controller.parmArgs(_args);
   controller.startOperation();
}

But pay attention!! This code forces the report to always run in batch mode

I prefer to parameterize the execution.

For example you can create a Menu item to call the report and passes a parameter to force the batch execution.

Something like that :

Set the parameter value of the menu item to “BatchExec

and then add this code to the Main method of the Controller class

public static void main(Args _args)

{

   TaxReportController_IT  controller = new TaxReportController_IT();

   controller.parmReportName(ssrsReportStr(TaxReport_IT, Report));

   //Execution in batch mode

   if (_args.parm() == 'BatchExec') //If Menu item parameter = BatchExec then the execution is in batch mode

   {

       controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);

   }


   controller.parmArgs(_args);
   controller.startOperation();

}

One thought on “AX / D365FO – Execute a SSRS report in batch mode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s