Sage 100

 View Only
Expand all | Collapse all

Script access to CredtCardAuthoriztionDate

  • 1.  Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 04:54
    Edited by Dan Burleson 05-06-2020 14:40
    Can anyone confirm that the in-memory value for "AuthoriztionDate" is being withheld for security reasons.

    An object dump shows that "AUTHORIZATIONDATE$" has a value so I expected the following GetValue to work since it returns 1, but it doesn't change the variable "dAuthorizationDate".
    dAuthorizationDate = ""
    retVal = oBusObj.GetValue("AUTHORIZATIONDATE$", dAuthorizationDate)​


    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------


  • 2.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 13:47
    is the "-" instead of a "=" on the first line a typo in your post or the script?

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 3.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 14:04
    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
    ------------------------------



  • 4.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 14:48
    Edited by Dan Burleson 05-06-2020 14:58
    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
    ------------------------------



  • 5.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 15:55
    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
    ------------------------------



  • 6.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-06-2020 16:01
    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
    ------------------------------



  • 7.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 01:59
    Edited by Dan Burleson 05-07-2020 02:00
    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 = " & retVal1
    sDebugMsg = sDebugMsg & "; CREDITCARDAUTHORIZATIONNO = " & sCreditCardAuthorizationNo & "; retVal = " & retVal2
    sDebugMsg = sDebugMsg & "; PAYMENTTYPECATEGORY = " & sPaymentTypeCategory & "; retVal = " & retVal3
    
    retVal = oScript.DebugPrint(SCRIPT_ID & sDebugMsg)​


    Results in empty strings:


    While an object dump reveals:
    AUTHORIZATIONDATE$="20200429"
    CREDITCARDAUTHORIZATIONNO$="134163"
    PAYMENTTYPECATEGORY$="P"​





    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------



  • 8.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:05
    Edited by David Speck II 05-07-2020 02:05
    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
    ------------------------------



  • 9.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:22
    Edited by Dan Burleson 05-07-2020 02:23
    I used GetKey and it comes back valid ('0210150000001') which is the SalesOrderNo followed by PaymentSeqNo. I'm wondering if this isn't some kind of security like in PII.

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------



  • 10.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:27
    What happens if you throw the GetValue for the payment object in a button script?
    Do you get a value returned then?

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 11.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:43
    Edited by Dan Burleson 05-07-2020 02:48
    Good call!


    I guess now, I have to convert my Table Pre-Write script to a faux Accept button. Any other ideas?
    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------



  • 12.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:50
    Well at least you know the data isn't being completely blocked by the GetValue method.
    In the table script, try using the value returned by GetKey (may need to use GetKeyPadded to be safe since it is a multi-part key) as the argument to a SetKey to force the object to read the record and then follow that by the GetValue.

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 13.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-07-2020 02:58
    I definitely will (tomorrow) as I don't like the faux Accept button approach. Now, I have to remove my testing code and get their proven production scripts in place.

    Thanks so much! (and I thought I worked late. Ha!)

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------



  • 14.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-11-2020 16:40
    @David Speck II Well, that worked! I used the table's key fields that I retrieved from the in-memory business object (SO_SalesOrderPayment_bus) via GetKey to immediately issue a SetKey to that same BO and the payment fields (that had been empty) then magically reappeared. It is so odd that the in-memory key (SalesOrderNo+PaymentSeqNo) remained available while all the fields I was looking for (AuthorizationDate, CreditCardAuthorizationNo and PaymentTypeCategory) were empty, but then reappeared with the SetKey (no padding required, as the GetKey returned a fully populated field.) Why does this happen and, a better question, how did you know to try this? Thank you AGAIN for your invaluable help.

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------



  • 15.  RE: Script access to CredtCardAuthoriztionDate

    Posted 05-13-2020 00:00
    Glad to hear that. Perhaps the payment object had already cleared the record's IOList variables but is still technically still sitting on the record thus causing the key to return the value. Chalk it help to just another quirk you have to learn the hard way, similar to the scenario where GetChildHandle sometimes does not return the expected data and requires a ReadAdditional prior to it in order to make sure the child record is read.

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------