Hi,
I'm trying to use vbs script to insert an entry into the AR_InvoiceHistory table using AR_InvoiceHistoryInquiry_bus object but I'm getting the following error:
Can anybody please help.
Hi,
I'm trying to use vbs script to insert an entry into the AR_InvoiceHistory table using AR_InvoiceHistoryInquiry_bus object but I'm getting the following error:
Can anybody please help.
Check the Primary Key of the table and you'll notice it has two fields: InvoiceNo and HeaderSeqNo. You can try to concatenate them together for a single SetKey line, but sometimes it's a bit of guessing…
Parag Vernekar it sounds like you are not using SetKeyValue()/SetKey() to put the record into an editable state prior to the Write(). Setkey() identifies the record you wish to edit or create and needs…
Nothing matters until you get the record into an editable state. Example from the scripting guide (which you'll have to adapt to your purpose):
retVal = oBusObj.SetKeyValue("ARDivisionNo$", sDiv)…
Parag Vernekar it sounds like you are not using SetKeyValue()/SetKey() to put the record into an editable state prior to the Write(). Setkey() identifies the record you wish to edit or create and needs to be done before setting any values or writing the record.
Hi. Thanks for replying.
I'm using nSetValue here to set value and still facing the same issue
Check the Primary Key of the table and you'll notice it has two fields: InvoiceNo and HeaderSeqNo. You can try to concatenate them together for a single SetKey line, but sometimes it's a bit of guessing to know how to null pad the key properly. SetKeyValue x2 plus the SetKey() is more reliable.
Thanks Kevin. But I'm still facing the same issue. I have added SetKeyValue method for HeaderSeqNo also.
Can you please crosscheck whether this will work?
Nothing matters until you get the record into an editable state. Example from the scripting guide (which you'll have to adapt to your purpose):
retVal = oBusObj.SetKeyValue("ARDivisionNo$", sDiv)
retVal = oBusObj.SetKeyValue("CustomerNo$", sCust)
retVal = oBusObj.SetKeyValue("ContactCode$", sContactCode)
'Now the do the SetKey() with no arguments:
retVal = oBusObj.SetKey()
'Now the row has been put into an Edit State
Just a slight clarification on Kevin M's last comment in his example.
' If retVal<>0 then the row has been put into an Edit State
The example was a copy / paste from the scripting guide.
haha - well I'm sure the (cough) author had the error check somewhere after that snippit
Not sure if you got this working yet but here's a snippet of VB code that I used to do something similar. I needed to update a UDF in AR_InvoiceHistoryHeader:
You need to reference AR_Customer_UI in order to write to the AR_InvoiceHistoryHeader table. Then you can get the record in an editable state with:
Once the record is editable, you can finish off by setting the value(s) you need to and write the record:
Sorry about the variations in font sizes, I'm pasting screen shots of sections of my code. I hope this helps.
Alternatively, you could write your data to a CSV, then trigger a Visual Integrator import using that CSV as input data. This technique is not great for minute to minute updates, but does work well for processing batches (eg. a daily upload) and is much easier to configure.
*Community Hub is the new name for Sage City