I am not able to set "Created From" on Invoice to reference a Sales Order record through the SOAP web service. I have tried setting this field directly and also through Initialize API (initializing a invoice record using the sales order and then copying the CreatedFrom field from the initialized invoice to the invoice being created).
I don't get any errors yet the Created From field doesn't get set on the created invoice record.
The code I am trying looks something like this:
// initialize invoice from sales order
var initializeRecord = new InitializeRecord()
{
type = InitializeType.invoice,
reference = new InitializeRef() { internalId = "sales-order-internal-id", type = InitializeRefType.salesOrder, typeSpecified = true }
};
var result = Utility.Do(async () => await connector.NetSuiteClient.initializeAsync(initializeRecord));
SuiteTalk.Invoice initializedInvoice = result.record;
// create a invoice and copy over the "createdFrom" field
var invoice = new SuiteTalk.Invoice();
invoice.createdFrom = initializedInvoice.createdFrom;
/* set other fields on the invoice and add some line items
....
...
..
*/
// finally create the invoice
var result = Utility.Do(async () => await connector.NetSuiteClient.addAsync(invoice));
How I can associate this invoice to a sales order while creating it?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…