Friday, February 5, 2016

AX - SSRS - SrsReportDataProviderPreProcess - Warning the user of a long run time

When running a preprocessing type of report it may cause the users AX client to freeze. So in order to let them know that it is actually running we may want to alert the user and give them the ability to choose not to run the report.

We can do this by overriding the preRunValidate() method on the controller class.

protected container preRunValidate()
{
    //let the user know that it will take a while to run
    return [SrsReportPreRunState::Warning, "This report may take a long time to run are you sure you want to run it?"];
}

SrsReportPreRunState (ENUM) is the type of alert. You can choose the following types

SrsReportPreRunState::Warning - will allow the user to choose if they should run the report or not
SrsReportPreRunState::Error - will stop the report from running
SrsReportPreRunState::Run - will start the report

Given these 3 types of commands available we can create logic based on current information and what course of action we can take.

By default the container only expects the enum SrsReportPreRunState but if we add a 2nd element then we can override the default text as well thus giving the user a more descriptive alert message.

example

[SrsReportPreRunState::Error, "The report has been canceled because it should only be run during the weekend"];

No comments:

Post a Comment