BOI UPD Object - Paperless Office

SOLVED

Has anyone ever successfully created a paperless office pdf when printing/updating a Sage register/journal via BOI?  I believe the documentation says to set the journal object's 'destination' property to 'PAPERLESS'.  While I'm able to post the register, despite my repeated attempts, I'm unable to generate the pdf in paperless.  The upd object's 'print journal' method is successful with 'PAPERLESS' being specified as the destination, but no pdf in paperless viewer, no pdf in the configured pdf directory.  Would be interested to hear if anyone got this to work and/or if they knew of any special tricks that are necessary. (I actually posted about this some time ago - based on the lack of responses to that post I'm guess no one has done this, but I thought I'd throw it out there again).  Thanks.

Parents
  • 0
    SUGGESTED

    Greetings,

    Just recently we helped a Partner with a similar issue.  Here is an excerpt of some sample code that will print a specific from setting to paperless.  Requires that Paperless Office be setup for forms in Sage 100.  I have not tested this for printing journals to paperless but I expect the logic would be similar for any paperless document.

     

    taskID = oSS.nLookupTask("AR_StatementPrinting_UI")
    retVal = oSS.nSetProgram(taskID)
    Set oARStatement = oScript.NewObject("AR_StatementPrinting_rpt", oSS)
    CurrentRptSetting = "TEST"  
    retval = oARStatement.nSelectReportSetting(CurrentRptSetting)

    'Set EmailSelected property to true
    oARStatement.nEmailSelected = 1

    Set oPaperless = oARStatement.ocoPLCommon
    oPaperless.sFormPrintUISelection = "2"

    ' Set Email Engine EESilent property to true
    oARStatement.oEmailEngineObj.nEESilent = 1

    ' Set Electronic Delivery.  Third argument is the email engine object handle for the from object. 
    ' Seventh argument is set to true to force no UI when processing
    retval = oPaperless.nElectronicDelivery("",0,oARStatement.oEmailEngineObj,0, "","",1)

    retVal = oARStatement.nProcessReport("PRINT")

    Thank you,

    Kent

  • 0 in reply to Kent Mackall

    Kent, using your sample code it works perfect in foreground on Sage100c 2017 if the console is actively logged in.   However we are not able to get the code to run while in background or thru a System Scheduler, such a MS Task Scheduler.    It seems that oARStatement.nSelectReportSetting(CurrentRptSetting) fails to pick up the CurrentRptSetting = "AR_Statement" (our form name) as nProcessReport("PRINT") will produce this error - Select a template to use.        Any thoughts as to why or how to run it in background?     Thanks

  • 0 in reply to Mike Ridgeway

    Are you passing a valid report setting that the user has access to in to the SelectReportSetting method?

    Thanks,

    Kent

Reply Children
  • 0 in reply to Kent Mackall

    Kent, we are passing valid report settings that the user has access to.   The code runs perfectly fine when manually ran from a cmd line prompt from the Sage Server, if in an active session.   We then put in a delay of 20 seconds in the first line of code, manually run it the same way and quickly disconnect from the session, the code will produce the errors.   nProcessReport returns (Select a template to use).    It will only run for us if in an active session.       Any thought on why?    Could the AR_StatementPrinter_rpt object have a bug of short?   Will it run for you in a disconnected session?     Thanks          

  • 0 in reply to Mike Ridgeway

    Greetings,

    Yes the script to print AR Statements to paperless runs from me without the Sage 100 Launcher running.  I have this in a VBScript that I just double-click to run. Have you created and run your template in Sage 100 before trying top use it in the script?  I can get the Select a Template to use message if I run this and select a template that doesn't have a record in the SY_ReportSetting.M4T table.

    Thanks,

    Kent

  • 0 in reply to Mike Ridgeway

    Do you have a local printer object installed on the machine?  It might work when connected using a redirected printer from the session, but as soon as you disconnect that printer disappears.

  • 0 in reply to Kevin M

    Kent,

    You nailed it.   The Sy_ReportSetting.m4t table did not have a machine entry for the Server the script was running.  It was using the redirect printer from my rdp session. 

    I logged in directly on the console ran the Sage process thru GUI to get an entry inserted into the Sy_ReportSetting table for the machine settings. The script now runs thru the scheduler while not logged in. 

    Perfect, thanks!!

  • 0 in reply to Mike Ridgeway

    Kent,
    It there a switch to pass to Sage’s smtp (mail) server when it encounters an error while nProcessReport("PRINT") is sending out AR Statements (electronically in background), such as the checkbox to ignore all errors?    Occasionally an error will occur, usually a smtp timeout. The process of sending out statements (waits on the response) to smtp dialog that is background.    Any thoughts or other parameters to pass to the email engine?          Thanks, Mike

  • 0 in reply to Mike Ridgeway

    Greetings,

    There is no parameter or setting that can be passed to the Sage 100 email engine to ignore errors.  Is it possible for you to increase the timeout on the mail server to see if that helps?

    Thanks,

    Kent

  • 0 in reply to Kent Mackall

    I wished we could as it is Sage's smtp (mail) server that only waits for 30 seconds.  My understanding is the timeout is hard coded to 30 seconds in Sage.  Please tell me different.      Thanks, Mike