I wonder if at that point in the header's pre write event, the payment object has already been cleared.
You can verify this by doing a DebugPrint and pass it the value returned by your payment object's GetKey() method.
If you find that the key is empty or equal to "0", then you may have to first use the browse filter approach to locate the payment record.
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------
Original Message:
Sent: 05-07-2020 01:58
From: Dan Burleson
Subject: Script access to CredtCardAuthoriztionDate
Thanks for the tips @David Speck II and @Kevin Moyes!
I get the same result. The values appear on the object dump, but fail to come through to a GetValue.
dAuthorizationDate = ""sCreditCardAuthorizationNo = ""sPaymentTypeCategory = ""Set oPaymentObj = oBusObj.AsObject(oBusObj.PaymentObj)retVal1 = oPaymentObj.GetValue("AUTHORIZATIONDATE$", dAuthorizationDate)retVal2 = oPaymentObj.GetValue("CREDITCARDAUTHORIZATIONNO$", sCreditCardAuthorizationNo)retVal3 = oPaymentObj.GetValue("PAYMENTTYPECATEGORY$", sPaymentTypeCategory)sDebugMsg = "AUTHORIZATIONDATE = " & dAuthorizationDate & "; retVal = " & retVal1sDebugMsg = sDebugMsg & "; CREDITCARDAUTHORIZATIONNO = " & sCreditCardAuthorizationNo & "; retVal = " & retVal2sDebugMsg = sDebugMsg & "; PAYMENTTYPECATEGORY = " & sPaymentTypeCategory & "; retVal = " & retVal3retVal = oScript.DebugPrint(SCRIPT_ID & sDebugMsg)
Results to:empty s
------------------------------
Dan Burleson
Software Consultant
Connex Software
Corvallis OR
541-224-6642
------------------------------
Original Message:
Sent: 05-06-2020 16:01
From: Kevin Moyes
Subject: Script access to CredtCardAuthoriztionDate
Here is something from an old SocialCast thread (when I was dealing with CC values) which might help.
------------------------------
Kevin Moyes
Technical Systems Analyst
Munjal White Consulting Co.
Toronto ON
Original Message:
Sent: 05-06-2020 15:54
From: David Speck II
Subject: Script access to CredtCardAuthoriztionDate
Probably best to go through the payment bus then during the pre-write.
There is an object handle to it available from the SO_SalesOrder_Bus object, the property name is PaymentObj.
------------------------------
David Speck II
Tennessee Software Solutions
Original Message:
Sent: 05-06-2020 14:48
From: Dan Burleson
Subject: Script access to CredtCardAuthoriztionDate
Thanks for catching the (corrected) typo! I am seeing the same thing. I did a dump from the from the command line and saw the data is there also. However, the above code runs in the SalesOrder Header Pre-Write even doesn't reflect what I see in the dump.
This is 2017.
Also, I can successfully read the same field from "SO_SalesOrderPayment_bus" and I get an AuthorizationDate. I only get a zero length string when I read it from an in-memory variable as in the snippet above.
------------------------------
Dan Burleson
Software Consultant
Connex Software
Corvallis OR
541-224-6642
Original Message:
Sent: 05-06-2020 14:04
From: David Speck II
Subject: Script access to CredtCardAuthoriztionDate
I threw a bunch of dummy data in an AR Invoice Entry in the ABC company and tested using the command window and got a value back. This was on 2019.2.
------------------------------
David Speck II
Tennessee Software Solutions
Original Message:
Sent: 05-06-2020 13:47
From: David Speck II
Subject: Script access to CredtCardAuthoriztionDate
is the "-" instead of a "=" on the first line a typo in your post or the script?
------------------------------
David Speck II
Tennessee Software Solutions