Changing Paperless office Output for Sales Orders

SOLVED

Hello, I am having some issues with making a script to change the output setting for paperless office inside of sales order printing. I have some code below that I found searching the forum. The way it is now I do not get an error message and nothing happens. I am doing this under Custom Office > Customizer Selection > Sales order Printing >>> SO_SALESORDERPRINTING.M4L and writing the script as a Panel - PostLoad. I just want to change the output to "Electronically Deliver Only"   Any help would be much appreciated.

SONo = ""
oSOPrint = ""
oPaperless = ""

retVal = oBusObj.GetValue("SalesOrderNo$", SONo)

Set oSOPrint = oSession.AsObject(oSession.GetObject("SO_SalesOrderPrinting_rpt"))

retVal = oSOPrint.SelectReportSetting("STANDARD")

oSOPrint.QuickPrint = SONo

'Set Paperless options
Set oPaperless = oSession.AsObject(oSOPrint.coPLCommon)

oPaperless.FormPrintUISelection="2"

retVal = oSOPrint.ProcessReport("PRINT")

  • 0

    If doing this on the post load of the sales order quick print panel, you should just be able to use the following.

    oUIObj.InvokeChange "DB_PaperlessOfficeOutput", "2"

    oScript.HandleScriptUI

    If you actually want to automate the process, then it would probably make more sense to add a new button to sales order entry and configure it to execute on the server, then in the script, repeat what you are already doing, i.e. getting the sales order number, set the program to "SO_SalesOrderQuickPrint_UI", get object handle to "SO_SalesOrderPrinting_Rpt", select report setting, set quick print property, set paperless office output property, and process the report.

  • +1
    verified answer

    The Paperless Office Output choice will persist when you setup a new Form Code (other than STANDARD).  Manually setup a new Form Code with whatever choice you need for Paperless Office Output then select that in your script.

  • 0 in reply to Steve Passmore

    Yes, good point, the answer I posted is really only needed if you must, for some reason, use the "STANDARD" form code/report setting.