Has anyone ever retrieved values from the AR_InvoiceHistory Header & Detail tables from inside a vb script?
At the end of the day I am trying to duplicate the logic behind the "Copy From" button on the sales order header screen so that when a user creates a new invoice in AR Invoice Data Entry, the user can enter a previous invoice number in a textbox, click on a button, and all values from the historical invoice will copy into the new invoice.
error_code = 0
invoice_number = "12827E"
invoice_type = ""
confirm_to = ""
SET oS = oSession.AsObject(oSession.GetObject("AR_Invoice_svc"))
retval = oS.SetKeyValue("InvoiceNumber$", invoice_number)
retval = oS.SetKeyValue("HeaderSeqNo$", "000000")
retval = oS.Find()
error_code = oS.GetValue("UDF_TYPE$", invoice_type)
error_code = oS.GetValue("ConfirmTo$", confirm_to)
msgbox(invoice_type)
msgbox(confirm_to)
The results of the two message boxes were blank values, and I know the data exists in the historical invoice for those fields.
I have also tries using the following with the same results:
SET oS = oSession.AsObject(oSession.GetObject("AR_InvoiceHistoryInquiry_svc"))
Any ideas? I think a stored procedure approach is a really bad idea when it comes to the lines screen mainly because of efficiency.