web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Error: Stack trace: Cannot run form on non interactive session. in batch job

(2) ShareShare
ReportReport
Posted on by 148
Hi,
I have a batch job and I have created a simple query based ssrs report.

I have added the following code in the service class after adding my logic and have called the report.
But facing error as Stack trace: Cannot run form on non interactive session.
I want to see the report in print archive
SrsReportRunController controller = new SrsReportRunController();
SRSPrintDestinationSettings printSettings;

controller.parmReportName(ssrsReportStr(TestSimpleReport, AutoDesign1));

controller.parmShowDialog(false);
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

printSettings = controller.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::Archive);

controller.parmReportContract().parmPrintSettings(printSettings);

controller.startOperation();
 
Categories:
I have the same question (0)
  • Suggested answer
    Saalim Ansari Profile Picture
    708 on at
    Hii @R Shetty,
     
    Try the below code 
    /// <summary>
    /// saveReportToArchive
    /// </summary>
    /// <param name = "_stream">System.IO.MemoryStream</param>
    /// <param name = "_filename">Filename</param>
    /// <param name = "_reportDescription">Description</param>
    private void saveReportToArchive(System.IO.MemoryStream _stream, Filename _filename, Description _reportDescription)
    {
        SRSPrintArchiveContract printArchiveContract;
    
    
        printArchiveContract = SRSPrintArchiveContract::construct();
        printArchiveContract.parmExecutionDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));
        printArchiveContract.parmExecutionTime(DateTimeUtil::getTimeNow(DateTimeUtil::getUserPreferredTimeZone()));
        printArchiveContract.parmFileName(_filename);
        printArchiveContract.parmJobDescription(_reportDescription);
        printArchiveContract.savePrintArchiveDetails(Binary::constructFromMemoryStream(_stream).getContainer());
    
        info('Report has been successfully generated and saved in Print archive.');
     
    } 
    Also your error says....

    You are trying to open a form (UI screen) inside a batch job.

    But batch jobs in Microsoft Dynamics 365 Finance and Operations run in the background (server-side), where:

    • There is no user interface
    • No browser / screen exists
    • No user interaction is possible

    So the system throws this error because it cannot display a form in a background process.

    Hope it helps ;) and let me know if you need more help!

  • Suggested answer
    Subra Profile Picture
    426 on at
    Hi

    Try the below code

    // Set report name
    controller.parmReportName(ssrsReportStr(SalesInvoice, Report));

    // Enable print management
    controller.parmUsePrintMgmt(true);

    // Configure print destination
    printSettings.printMediumType(SRSPrintMediumType::Archive);

    // Attach settings to controller
    controller.parmReportContract().parmPrintSettings(printSettings);

    // Optional: run in batch
    controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

    // Run report
    controller.startOperation();

    Still the issue exists, please enable debug and check which line you are getting the error message

     
  • Deepak Agarwal Profile Picture
    8,770 on at
    What you are trying to acheve from your report and how you are running your report? The error in general meaning you are trying to run a dialog in non interactive way which is not allowed. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 608

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 591 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans