Has anyone had any luck creating a BOI script to print and update invoices when batches are enabled? I keep getting a message stating that batching can't done in the current task. Here's a snippet of my code:
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_InvoicePrinting_UI"))
Set oSO_InvPrint = oPVX.NewObject("SO_InvoicePrinting_rpt", oSS)
retVal = oSO_InvPrint.nSelectBatch(vBatchNo) <== vBatch is a good Sales Order Invoice Batch that is "available" when I run the script.
MsgBox("Select Batch " & vBatchNo & "; " & oSO_InvPrint.sLastErrorMsg) <== Here's where I see the error message
retVal = oSO_InvPrint.nSelectReportSetting("STANDARD")
MsgBox("91 = " & retVal) <== returns 1
retVal = oSO_InvPrint.nProcessReport(vDestination) <== vDestination = "PREVIEW"
MsgBox("Print: " & oSO_InvPrint.sLastErrorMsg)
oSO_InvPrint.DropObject
I'm doing this in 2022 Advanced. <== indicates a comment in the code for clarification here only. Here's the message box with the last error:
Any assistance would be appreciated. Thanks!