Need help with UDS and GetChildObject method to access "AR_PaymentType_Bus"

SOLVED

Here's my situation:

The UDS is on the Pre-Totals event of S/O invoice header and I am trying to access a field in the "AR_PaymentType" table. I would appreciate if anyone could see by blunder in any of the 4 methods I describe here.

Methods I've tried:

  1. The oBusObj.GetDataSources() method indicates that "PaymentType" is a child of the invoice header, but the statement:
    Set oPaymentType = oBusObj.AsObject(oBusObj.GetChildHandle("PaymentType"))
    returns an error "Wrong number of arguments or invalid property assignment"
  2. If I separate the combined statements above into two:
    oPaymentType = oBusObj.GetChildHandle("PaymentType")
    retVal = oScript.DebugPrint(SCRIPT_ID & "oPaymentType = " & oPaymentType)
    	
    Set oPaymentType = oBusObj.AsObject(oPaymentType)
    retVal = oScript.DebugPrint(SCRIPT_ID & "oPaymentType = " & oPaymentType)
    the GetChildHandle method above returns oPaymentType = 100078 (which matches the variable "coPaymentTypeChild" value in a debug dump),
    but the Set statement gets the same error as in #1 above: "Wrong number of arguments or invalid property assignment".
  3. I tried using the existing variable "coPaymentTypeChild" directly in this statement:
    oPaymentObj = 0
    retVal = oBusObj.GetValue("coPaymentTypeChild", oPaymentObj)
    retVal = oScript.DebugPrint(SCRIPT_ID & "oPaymentObj = " & oPaymentObj)
    if oPaymentObj <> 0 Then
    		Set oPaymentObj = oBusObj.AsObject(oPaymentObj)
    the DebugPrint show oPaymentObj as 100078 (again, matching the variable "coPaymentTypeChild" value in a debug dump),
    but the Set statement gets an error "Invalid/Unknown property name, Wrong number of arguments or invalid property assignment (err/ret=2/0)"
  4. My final attempt is to access the "AR_PaymentType_Bus" table directly and "SetKey" to the specific PaymentType with both of the following statements (separately):
    Set oPaymentObj = oBusObj.AsObject(oBusObj.GetObject("AR_PaymentType_bus"))
    Set oPaymentObj = oSession.AsObject(oSession.GetObject("AR_PaymentType_bus"))
    Both these statements get the error message "Invalid/unknown property name, Wrong number of arguments or invalid property assignment (err/ret=2/0)"
     
Parents
  • +1
    verified answer

    I think the PaymentType child goes to the invoice's payment entry, which probably won't exist unless it's a CC transaction...

    If you just want to look up a value in AR_PaymentType, why not flow a UDF into the invoice header (instead of doing a lookup)?

Reply
  • +1
    verified answer

    I think the PaymentType child goes to the invoice's payment entry, which probably won't exist unless it's a CC transaction...

    If you just want to look up a value in AR_PaymentType, why not flow a UDF into the invoice header (instead of doing a lookup)?

Children