"Cannot run form on non interactive session" error

Hello,

I am trying to run a salesFormLetter_invoice.update using an Async call and I get the following error message.

“Cannot run form on non interactive session”

My code looks like this:

    static public void PrintProformaInvoice(container _CallingParameters)
    {
        salesFormLetter_invoice       salesFormLetter_invoice;
        SalesTable                    sTable;
        
        sTable = SalesTable::find(conPeek(_CallingParameters, 1));
        salesFormLetter_Invoice = salesFormLetter::construct(DocumentStatus::Invoice);
        salesFormLetter_Invoice.update(sTable,
                                       DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()),
                                       SalesUpdate::PickingList,
                                       AccountOrder::None,
                                       true,    // Proforma
                                       True,    // Print form letter
                                       true);   // Use print management
    }

    public static void ProcessAdditionalReports(SalesId _SalesId)
    {
        Global::runAsync(classNum(asyncTest), staticMethodStr(asyncTest, printProformaInvoice), [_SalesId]);
    }

I have also tried it from a button on a form and using element.RunAsync, but it fails as well. Is there issues with running the sales invoice formletter this way?

Shawn T.

Where exactly does it error come from?

I traced the process through the salesFormLetter class and there wasn’t an error. Execution passed through the PrintProformaInvoice method back to the ProcessAdditionalReports method and through it. I exit the form that this started on and wait in the main workspace for about 10-15 seconds and then an error appears in the action center.

FormletterError.png

No invoice is displayed in the print archive (where it is setup in print management to go.)

Put breakpioint to Info.add(), attach the debugger to both the web server (iisexpress.exe, most likely) and batch.exe and run it again. It should stop on the error message and the call stack will tell where it was called from.

Sorry for the late response as I was out sick last week. I found where the error was coming from. Apparently another user who was checking out other functionality in my box decided to change the print management settings for my report. They set it to print to the screen and print archive and once I got rid of the screen option, the process did not error out. Thank you for your help on this.

Shawn