title: Associate invoice to a Sales Order
body: <p>I am not able to set &quot;Created From&quot; 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).</p>
  <p>I don't get any errors yet the Created From field doesn't get set on the created invoice record.</p>
  <p>The code I am trying looks something like this:</p>
  <pre><code>// initialize invoice from sales order
  var initializeRecord = new InitializeRecord()
              {
                  type = InitializeType.invoice,
                  reference = new InitializeRef() { internalId = &quot;sales-order-internal-id&quot;, type = InitializeRefType.salesOrder, typeSpecified = true }
              };            
              var result = Utility.Do(async () =&gt; await connector.NetSuiteClient.initializeAsync(initializeRecord));
  SuiteTalk.Invoice initializedInvoice = result.record;
  
  // create a invoice and copy over the &quot;createdFrom&quot; 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 () =&gt; await connector.NetSuiteClient.addAsync(invoice));
  </code></pre>
  <p>How I can associate this invoice to a sales order while creating it?</p>