Script not working on workstation

SOLVED

I have a script that I wrote and installed on the server remotely. Worked fine. It was attached to the CustomerNo field in Sales Order Entry. When the user attempted to create a sales order, as soon as they selected a Customer it locked up Sage 100 and the user had to exit out the Sage 100 and restart the program.  Does anyone have any thoughts on what could be causing the work station to lock up.

sLast = ""
sDate = ""
newDate =""
oDate =""
retVal = oBusObj.GetValue("UDF_LASTACTIVITY$", sLast)
retVal = oBusObj.GetValue("OrderDate$", sDate)
retVal = oSession.FormatDate(sLast, newDate,"%M/%D/%Y")
retVal = oSession.FormatDate(sDate, oDate,"%M/%D/%Y")
newDate = DateAdd("D",730,newDate)
newDate = oSession.GetFormattedDate(CStr(newDate))
oDate = oSession.GetFormattedDate(CStr(oDate))
If newDate < oDate Then MsgBox("Please request new credit information as it has been 24 months since last activity")End IF

  • +1
    verified answer

    Broke down and read the Sage documentation and it works as expected now. Here it is:

     

    sLast = ""

    sDate = ""

    newDate =""

    oDate =""

    sMsg = ""

    retVal = oBusObj.GetValue("UDF_LASTACTIVITY$", sLast)

    If sLast <>"" Then ‘checking to see if the UDF is null or not.

    retVal = oBusObj.GetValue("OrderDate$", sDate)

    retVal = oSession.FormatDate(sLast, newDate,"%M/%D/%Y")

    retVal = oSession.FormatDate(sDate, oDate,"%M/%D/%Y")

    newDate = DateAdd("D",730,newDate)

    newDate = oSession.GetFormattedDate(CStr(newDate))

    oDate = oSession.GetFormattedDate(CStr(oDate))

    sMsg = "Please request new credit information as it has been 24 months since last activity"

    If newDate<oDate Then ‘checking to see if it has been 24 months since last activity

    retMsg = oSession.AsObject(oSession.UI).MessageBox("",sMsg)

    End If

    End If

  • 0 in reply to BigLouie

    I hate when that happens!