I have my script working to select invoice batches in S/O Invoice Printing. Once the batch is selected the invoices are electronically delivered. This all works fine. It needs to run unattended with no UI. How do I stop the Sales Journal prompt after the printing? I found the following functions but they don't seem to work as described.
FUNCTION PostPrintProcessing(forceChain) | ||||||
FUNCTION PostPrintProcessing(forceChain, inExit) | ||||||
Performs post print processing (updates and chain check) when exiting printing |
||||||
|
||||||
|
I tried putting the function before the printing and after. The function seems only to make matters worse by forcing yet another Sales Journal prompt. Here's some of my code for reference:
'Print Invoices in the batch
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_InvoicePrinting_UI"))
Set oSO_InvPrint = oPVX.NewObject("SO_InvoicePrinting_rpt", oSS)
retVal = oSO_InvPrint.nSelectBatch(vBatchNo)
retVal = oSO_InvPrint.nSelectReportSetting("CUSTOM")
oSO_InvPrint.nEmailSelected = 1
oPaperless = 0
Set oPaperless = oSO_InvPrint.ocoPLCommon
oPaperless.sFormPrintUISelection = "2" 'Electronic Delivery Only (Includes PDF)
oSO_InvPrint.oEmailEngineObj.nEESilent = 1
retval = oPaperless.nElectronicDelivery("",0,oSO_InvPrint.oEmailEngineObj,0, "","",1)
retVal = oSO_InvPrint.nPostPrintProcessing(0)
retVal = oSO_InvPrint.nProcessReport(vDestination)
oSO_InvPrint.DropObject
Just an additional note, I tried retVal = oSO_InvPrint.nPostPrintProcessing(0, 1) , retVal = oSO_InvPrint.nPostPrintProcessing(0,0), retVal = oSO_InvPrint.nPostPrintProcessing(False, False) etc. with no luck. Any suggestions would be greatly appreciated. This is in v2022 Advanced. Thanks!