Button Script to Add Comment Line to GD_Lines Table in SO Invoice Data Entry

SOLVED

From the Payment tab in SO Invoice Data Entry I have added a button with the caption "CC Receipt". Upon a user clicking this button I would like a comment (Item code /C) added to the next line number with details from the credit card.

First I actually attempted to do this through Crystal Reports, but I was running into issues with tables breaking things depending on if the invoice was posted (SO_InvoiceHistory) or not (SO_InvoiceDetails) as for whatever reason CC transaction details wasn't included in the SO_InvoiceWrk table.

So then I attempted to place the text for the comment into the user's clipboard, but I was unsuccessful in creating the required objects on the Sage server that would work with VBScript. Which brings me here:

How can I add a comment item type to the next line of the GD_Lines table in the Lines tab (keep in mind the user will be in the Payment tab upon clicking the button script)? Here's what I have so far:

Dim CardNo:    CardNo = Right(GetProp("LAST4UNENCRYPTEDCREDITCARDNOS", "Value$"), 4)
Dim CardType:  CardType = GetProp("ML_CARDTYPE", "Value$")

Dim isOkayToProceed: isOkayToProceed = True

Select Case CardType
Case "Visa", "MasterCard"
    CardNo = "XXXX-XXXX-XXXX-" & CardNo
Case "AMEX"
    CardNo = "XXXX-XXXXXX-X" & CardNo
Case Else
    Msg "This card type (" & CardType & ") is not set up!"
    isOkayToProceed = False
End Select

If isOkayToProceed Then

    Select Case CardType
    Case "Visa"
        CardType = "VISA CC #            "
    Case "AMEX"
        CardType = "AMEX CC #            "
    Case "MasterCard"
        CardType = "MSTR CC #            "
    Case "DISC"
        CardType = "Discover CC #        "
    Case Else
        CardType = vbNullString
    End Select
    
    Dim PmtAmt:    PmtAmt = CCur(GetProp("ML_CC_BALANCE", "Value"))
    Dim AuthNo:    AuthNo = GetProp("CREDITCARDAUTHORIZATIONNO", "Value$")
    Dim AuthAmt:   AuthAmt = GetProp("TRANSACTIONAMT", "Value")
    Dim AuthDate:  AuthDate = CDate(GetProp("AUTHORIZATIONDATE", "Value"))
    Dim AuthTime:  AuthTime = GetProp("AUTHORIZATIONTIME", "Value")
    Dim TransID:   TransID = GetProp("CREDITCARDTRANSACTIONID", "Value$")
    
    Dim CommentText
    CommentText = _
    "************************* CREDIT CARD RECEIPT *************************" & vbNewLine & _
    "    " & CardType        & vbTab & CardNo & vbNewLine & _
    "    Charge Amount     " & vbTab & AuthAmt & vbNewLine & _
    "    Transaction ID #  " & vbTab & TransID & vbNewLine & _
    "    Authorization #   " & vbTab & AuthNo & vbNewLine & _
    "*********************************************************************************"

    'GD_LINES is the name of the main table
    oUIObj.InvokeChange "GD_Lines", "..." ?????
    
End If

Private Sub Msg(t)
    oSession.AsObject(oSession.UI).MessageBox "", CStr(t)
End Sub

Private Function GetProp(ctlName, pName)

    Dim retVal
    oUIObj.GetControlProperty ctlName, pName, retVal
    GetProp = retVal
    
End Function