Scripting

  • 1.  Having an issue with a script that retrieves UDF v

    Posted 03-10-2016 09:14
      |   view attached
    Having an issue with a script that retrieves UDF values from the SO_ShipToAdress table when the ship to address changes on a sales order. Works in my development environment but when I move it to the customers, I get and ERROR 26 Program SY_Service.pvc line 1471. Error message is attached. The script is below. Any thoughts would be great.TIA ARDiv = """" ARCust = """" tmpcustkey = """" shiptobrokercode = """" shiptobrokername = """" shiptocommrate = 0.00 ' First validate if there is a ship to address assigned ' if there is not than we need to populate the broker fields ' based on the customer master records since the udf fields are ' prepopulated from the ship to 'code via the udf data sources retval = oBusObj.GetValue(""ShipToCode$"",shiptocode) retval = oBusObj.GetValue(""ARDivisionNo$"",ArDiv) retval = oBusObj.GetValue(""CustomerNo$"",ArCust) retval = oScript.DebugPrint(ARdiv & ""-"" & ArCust & "" "" & shiptocode) set oship = oSession.AsObject(oSession.GetObject(""SO_SHIPTOADDRESS_SVC"")) retval = oship.SetKeyValue(""ARDivisionNo$"",ARDiv) retval = oship.SetKeyValue(""CustomerNo$"",ArCust) retval = oship.SetKeyValue(""ShipToCode$"",shiptocode) retval = oShip.FInd() shiptobrokercode = """" shiptobrokername = """" shiptocommrate = 0.00 retval = oship.GetValue(""UDF_SHIPTO_BROKER_CODE$"",shiptobrokercode) retval = oship.GetValue(""UDF_SHIPTO_BROKER_NAME$"",shiptobrokername) retval = oship.GetValue(""UDF_SHIPTO_BRK_COMM_RATE"",shiptocommrate) retval = oScript.DebugPrint(""Ship to Child Object Values: "" & shiptoBrokerCode & ""_"" & shiptoBrokerName & ""_"" & shiptoCommRate) set oCust = oBusObj.AsObject(oBusObj.GetChildHandle(""CustomerNo"")) setbrokercode = """" setbrokername = """" setbrokercommrate = 0.00 retval = oCust.GetValue(""UDF_BROKER_CODE$"",SetBrokerCode) retval = oCust.GetValue(""UDF_BROKER_NAME$"",SetBrokerName) retval = oCust.GetValue(""UDF_BRK_COMM_RATE"",SetBrokercommrate) retval = oScript.DebugPrint(""customer Child Object Values: "" & SetBrokerCode & ""_"" & SetBrokerName & ""_"" & SetBrokerCommRate) retval = oScript.DebugPrint(""Ship To Code: "" & shiptocode) retval = oScript.DebugPrint(""Customer: "" & ARDiv & ""-"" & ArCust) if shiptocode = 0 or ShipToCode = """" then retval = oScript.DebugPrint(""Values set based on customer"") retval = oBusObj.SetValue(""UDF_BROKER_CODE$"",setbrokercode) retval = oBusObj.SetValue(""UDF_BROKER_NAME$"",setbrokername) retval = oBusObj.SetValue(""UDF_BRK_COMM_RATE"",setbrokercommrate) else retval = oScript.DebugPrint(""Values set based on ShipTo"") retval = oBusObj.SetValue(""UDF_BROKER_CODE$"",shiptobrokercode) retval = oBusObj.SetValue(""UDF_BROKER_NAME$"",shiptobrokername) retval = oBusObj.SetValue(""UDF_BRK_COMM_RATE"",shiptocommrate) End If

    Attachment(s)

    txt
    _RKL2457458629.txt   32 KB 1 version


  • 2.  RE: Having an issue with a script that retrieves UDF v

    Posted 03-10-2016 09:21
    Is shiptocode defined? Does it debugprint anything before failing?


  • 3.  RE: Having an issue with a script that retrieves UDF v

    Posted 03-10-2016 09:31
    Shiptocode isn't defined but it works in the dev environment. It won't debug print anything. I am going to take a look at the source code for the error and see where that may point me.