I've got this really odd problem. I've poured over my code and can't find the issue. The scenario is this, I need to open an existing sales order and assigning incrementing numbers to a custom field on the line item. So if I had a sales order with 3 lines, I would want 00001, 00002 and 00003 as the values in the custom field. The error seems to be on the line just above the 'Next' command. Whenever I assign the value to the custom field, it overwrites the value of the line items above it as well. In then end, all the lines in the sales order end up with a value of 00003.
Any feedback is appreciated.
newSO = New netsuite.webservices.SalesOrder
newSO.internalId = oSalesOrder.internalId
newSO.itemList = oSalesOrder.itemList
For i2 = 0 To oSalesOrder.itemList.item.Length - 1
iTicketNumber = iTicketNumber + 1
'update the ticket numbers in netsuite
oTicketField = New netsuite.webservices.StringCustomFieldRef
oTicketField.internalId = "CUSTCOL_TICKETNUMBER"
oTicketField.value = CStr(iTicketNumber).PadLeft(5, CChar("0"))
oTickerCustomFields(0) = New netsuite.webservices.StringCustomFieldRef
oTickerCustomFields(0) = oTicketField
newSO.itemList.item(i2).customFieldList = oTickerCustomFields
Next
'update netsuite
oRespStatus = New netsuite.webservices.Status
oResponse = New netsuite.webservices.WriteResponse
oResponse = oService.update(newSO)