I'm working on creating invoices in Quickbooks through QBFC. I'm having trouble adding Custom Field information to my InvoiceAdd request. I'm using the following code:
Dim CountryExt As IDataExtAdd = msgReq.AppendDataExtAddRq
CountryExt.DataExtName.SetValue("Country")
CountryExt.DataExtValue.SetValue("Spain")
CountryExt.OwnerID.SetValue(0)
CountryExt.ORListTxnWithMacro.TxnDataExtWithMacro.TxnDataExtType.SetValue(ENTxnDataExtType.tdetInvoice)
CountryExt.ORListTxnWithMacro.TxnDataExtWithMacro.TxnID.SetValueUseMacro("TxnID:" & i)
The Add Request works perfectly for custom fields that do not have default values set by the customer, but causes an Index out of Range error when trying to overwrite a value that is set by the customer.
For example, if the Quickbooks Customer had the custom field 'Country' set to 'Portugal' the code would produce an invoice out of range error. However, if the Customer did not have a default 'Country' the code would set the 'Country' field on the invoice.
Do I need to add custom data through a second dataextmodrq after invoice creation, or am I missing some UnSet option?