Script to retrieve altcountrycode not working

SOLVED

I get an error whenever I try to set the Country Business object, either as a childhandle or asObject.  I have no idea why this keeps getting an error 88.

'Title: UDF_Alt_Country_Code
'Desc: Autofill the UDF_Alt_Country_Code after selecting Country Code
'Bus Object: SY_Country_Bus
'Event: Column post validate on CountryCode

'Version 1.02

retVal = 0
CountryCode = ""
AltCountryCode = ""
oRegion = 0
oCountry = 0

If oSession.CompanyCode = "ADX" OR oSession.CompanyCode = "ZIT" OR oSession.CompanyCode = "ZZZ" then

retVal = oBusObj.GetValue("COUNTRYCODE$",CountryCode)

retVAl = oScript.DebugPrint("GOT HERE 1." & " " & CountryCode & " " & oCountry)

'1st attempt set oCountry = oBusObj.AsObject(oBusObj.GetChildHandle("CountryCode"))

nCountry=0 : nCountry = oSession.GetObject("SY_Country_BUS")

retVAl = oScript.DebugPrint("GOT HERE 2." & " " & CountryCode & " nCountry: " & nCountry)

Set oCountry = oSession.AsObject(nCountry)


retVAl = oScript.DebugPrint("GOT HERE 3." & " " & CountryCode & " " & oCountry)


if oCountry <> 0 then
Set oCountry = oScript.AsObject(oCountry)

retVal = oCountry.Find(CountryCode)
retVal = oCountry.GetValue("AltCountryCode",AltCountryCode)

retVAl = oScript.DebugPrint("GOT HERE 2." & AltCountryCode)

retVal = oBusObj.setvalue("UDF_Alt_Country_Code$",AltCountryCode)

End If

End If

Top Replies

Parents Reply
  • 0 in reply to Kevin M

    Thanks for the screenshot and response, but I still can't get past that set line.  I have a debug message line right after and the error comes before that message line.  My set line is exactly like yours   I appreciate you taking the time to respond, but I'm stumped.  I think I might just go with what is working, and not spend any more time on this.  Thanks all!!

Children
No Data