Hi Forum,
I am trying to populate a date in UDF based on a date in UDT plust 7 or 14 days depending on the Whse code.
i've tried what i know and what i got from the forum and i am still getting an error on the following message.
here is the script code:
BOLNum = "" : ETA = "" : strEvent = "" : strTracking = "" : strETA1 = "" : sWhse = "" : newDate = ""
Dim strETADate
Dim strETA
sCompany = oSession.CompanyCode
if sCompany = "TK4" then
Set oBOL = oSession.AsObject(oSession.GetObject("CM_UDTMaint_bus", "PO_UDT_BOL_TRACKING"))
retVal = oBusObj.getValue("UDF_MASTERS_BLPO$", BOLNum)
retVal = oBusObj.getValue("WarehouseCode$", sWhse)
retVal = oBOL.SetKey(BOLNum)
if retVal > 0 then
retVal = oBOL.GetValue("UDF_ETA$", strETA)
'sretval = oSession.AsObject(oSession.UI).MessageBox("", "ETA Date: " & strETA)
if sWhse = "BRI" then
retVal = oSession.FormatDate(strETA, newDate, "%Mz%Dz%Y")
newDate = DateAdd("D", 7, newDate)
newDate = oSession.GetFormattedDate(CStr(newDate))
Else
if sWhse = "PAC" then
retVal = oSession.FormatDate(strETA, newDate, "%Mz%Dz%Y")
newDate = DateAdd("D", 14, newDate)
newDate = oSession.GetFormattedDate(CStr(newDate))
end if
end if
'Populate PO Line ETA
retVal = oBusObj.SetValue("UDF_ETA_DATE$", newDate)
End if
End if
Any suggestions?
Regards