When creating a new invoice how can I pass additional data for the invoice.
invoiceAdditionalData.DataExtName.SetValue("PO/SA#");
invoiceAdditionalData.DataExtValue.SetValue("a unique number for this invoice");
invoiceAdditionalData.OwnerID.SetValue("0");
invoiceAdditionalData.ORListTxn.ListDataExt.ListDataExtType.SetValue(ENListDataExtType.ldetCustomer);
invoiceAdditionalData.ORListTxn.ListDataExt.ListObjRef.FullName.SetValue(invoiceAdd.CustomerRef.FullName.GetValue());
The code above always changes the customers additional data, so all existing invoices get the new value. How do I tell the QBFC that this additional data is for the invoice and not for the customer. EDIT: Working version
IDataExtAdd invoiceAdditionalData = requestMsgSet.AppendDataExtAddRq();
invoiceAdditionalData.DataExtName.SetValue("PO/SA#");
invoiceAdditionalData.DataExtValue.SetValue("the id");
invoiceAdditionalData.OwnerID.SetValue("0");
invoiceAdd.defMacro.SetValue("TxnID:" + invoiceNo);
invoiceAdditionalData.ORListTxnWithMacro.TxnDataExtWithMacro.TxnDataExtType.SetValue(ENTxnDataExtType.tdetInvoice);
invoiceAdditionalData.ORListTxnWithMacro.TxnDataExtWithMacro.TxnID.SetValueUseMacro("TxnID:" + invoiceNo);
In your last 2 lines you're telling it to update the customer, not the invoice. Instead of ListDataExt, use TxnDataExtWithMacro (for DataExtAdd - you don't need a macro) or TxnDataExt (for DataExtMod). The specify tdetInvoice as the type in line 4, and give it the Invoice's TxnID in line 5.