Sage 100

 View Only
  • 1.  Custom Office Script and Sage Advanced vs Standard

    Posted 05-19-2022 22:14
    I have a script that works in SO Order data entry and is displaying a check box if the customer has paperless office (SO Invoice) turned on for this customer. We not concerned with whom it is going to email, just that it is going to email (aka Paperless Office).

    It all works on my v2019 Standard Version. On the client, it is mostly working. The box is getting check when appropriated.

    If the UDF box is uncheck, the client is clicking on the customer hyperlink from SO Order data entry by going to Customer> Paperless> and updating the record. They are getting "the lock information was not found" message.

    The last line of my script is oSession.DropObject("AR_CustomerDocuments_bus"), so I assumed that this was clearing the business objects. The only difference is I am running Standard and they are Advanced.  Ideas?

    I have tried _SVC instead of _bus and the same results.
    I tried using Find(xxx) instead of the setkey(), but same locking message as well

    Other part of script
    'To Pull from AR Customer for Order
    if StartProgram = "SO_SALESORDER_UI" then
    SET oARCustomer = oSession.AsObject(oSession.NewObject("AR_CustomerDocuments_bus"))
    retVal =oARCustomer.SetKeyValue("ARDivisionNo$",ARDivisionNo)
    retVal = oARCustomer.SetKeyValue("CustomerNo$",CustomerNo)
    retVal = oARCustomer.SetKeyValue("Document$","S/O Order")

    retVal = oARCustomer.SetKey()

    retVal =oARCustomer.GetValue("EmailDocument$",EmailDocument)
    if EmailDocument = "Y" then
    retval=oBusObj.Setvalue("UDF_EMAIL_DOCUMENT$","Y")
    end if

    'CleanUp
    oSession.DropObject("AR_CustomerDocuments_bus")

    #CustomOffice #Advanced #Scripting

    ​​​

    ------------------------------
    Michael Davis
    Warren Averett Technology Group
    ------------------------------


  • 2.  RE: Custom Office Script and Sage Advanced vs Standard

    Posted 05-20-2022 04:11
    Change it from "NewObject" to "GetObject". I think one calls the other and NewObject should work theoretically but it's generally used with BOI. Then change the SetKey() to .Find() again. Then near the end, do a oARCustomer.Clear()

    I think all 3 of those things should take care of the error. AR_CustomerDocuments_bus is probably an odd duck.  

    For the DropObject not working, it is going to create a problem over the course of the day as a memory leak if you stay in S/O Entry all day long. @David Speck II recently mentioned to me a more precise way he has to do this. The 1st part is normal which is to break the GetObject into the 2 part form separating the GetObject from the AsObject. The addl / different part is to capture the GetObject part it as a numeric variable and then pass that into the DropObject. Something like this - I haven't tested it yet but I'm pretty sure he will correct it if necessary and clarify it further.

    nARCustomer = 0
    nARCustomer = oSession.GetObject("AR_CustomerDocuments_bus") 'Returned as a number, not an object
    If nARCustomer <> 0 Then Set oARCustomer = oSession.AsObject(nARCustomer) 'Now oARCustomer became an object

    'later on
    oSession.DropObject nARCustomer  'this passes the object handle as a number which is also supported and more precise


    ------------------------------
    Alnoor Cassim

    Email: alnoor@asifocus.com
    Ph:
    ------------------------------



  • 3.  RE: Custom Office Script and Sage Advanced vs Standard

    Posted 05-20-2022 10:28

    Alnoor.

     

    Thank you. That worked great on the Advanced version at the client.

     

    Michael

     

     

    Michael  H . Davis

    CPA.CITP, MCSE

    Senior Consultant

    Michael.Davis@warrenaverett.com

    (D) 

    205.313.4734

    (O) 

    205.313.4700   

    (F) 

    205.592.9991

    2500 Acton Road, Birmingham, AL 35243

    Ranked as one of the top managed service providers (MSP)
    and managed security service providers (MSSP) 
    in the world several years in a row. 

     

     

     

    To contact our Software Support Team call 844.712.6223 or email software@warrenaverett.com.
    To contact our Technical Services Team call 888.419.9090 or email resource.center@warrenaverett.com

    Warren Averett is celebrating 50 years of serving our community and clients. 
    Learn more about our history and where we're going in the future.