Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Close SSRS report after excel generated

Posted on by 207
Hi,
I have created SSRS report which will create excel directly on report generation. but after excel generated the page is not closing and shows a blank page. It should redirect to home page after excel is generated.
 
Please find the below code for reference.
public final class OrderBookReportController extends SrsReportRunController implements BatchRetryable{    SRSPrintDestinationSettings printDestinationSetting;   /// <summary>   /// Main method   /// </summary>   /// <param name = /_args/>args</param>    public static void main(Args _args)    {        NAVOrderBookReportController controller = new OrderBookReportController();        controller.parmReportName(ssrsReportStr(OrderBookReport,Report));        controller.parmArgs(_args);        controller.parmShowDialog(false);        controller.startOperation();       //FormRun fr= _args.caller();       // fr.close();      //  _args.caller().close();                  }    protected void preRunModifyContract()    {        printDestinationSetting = new SRSPrintDestinationSettings();        printDestinationSetting.printMediumType(SRSPrintMediumType::File);        printDestinationSetting.fileName(System.IO.Path::GetTempPath() +/OrderBookReport.XLSX/);        printDestinationSetting.fileFormat(SRSReportFileFormat::Excel);        printDestinationSetting.overwriteFile(true);        this.parmReportContract().parmPrintSettings(printDestinationSetting);      }}
 
Please suggest.
Thanks,
Priya
  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,540 Super User on at
    Close SSRS report after excel generated
    Hi Priya, In addition, you can check this article and let us know if still issues.
     
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,828 Super User on at
    Close SSRS report after excel generated
    Hi Priya,
     
    I am not sure why this happening.
    But instead of extending the controller class - Create normal class like mentioned in the below blog.
    I mean don't extend the SrsReportRunController.
     
    Thanks,
    Girish S.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans