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

(0) ShareShare
ReportReport
Posted on by 133
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
    689 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!

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 March 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 710

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 317 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans