Relate/link vendor bill to purchase order in Netsuite
<p>I have created vendor bill with nlapiCreateRecord, I can see the Bill record in the system with all items I want, but I can't relate it / link it to specific Purchase Order natively. When I'm using nlapiTransformRecord I'm deleting all records first from the PO and I'm adding new line items from CSV, but the native link/relationship between PO and Vendor Bill is missing. Here is my code created for the Bill Import from CSV:</p>

<pre><code>function BillImport() {

var fromrecord;
  var fromid;
  var torecord;
  var record;
  var qty;

  fromrecord = 'purchaseorder';
  fromid = 23664;
  torecord = 'vendorbill';

var loadedBillFile = nlapiLoadFile(5034);
var loadedBillString = loadedBillFile.getValue();
var BillLines = loadedBillString.split('\r\n'); //split on newlines

  record = nlapiTransformRecord(fromrecord, fromid, torecord);
  //trecord.setFieldValue('location', 1);
  //trecord.setFieldValue('tranid', 'TEST!');

  //var record = nlapiCreateRecord('vendorbill');

    for (var j = record.getLineItemCount('item'); j&gt;=1; j--)
   {

       record.removeLineItem('item',j);

   }

    for (var i = 1; i &lt; BillLines.length; i++) {
     var cols = BillLines[i].split(';');

     var dsplit = cols[4].split(".");
     var date = new Date(dsplit[2],dsplit[1],dsplit[0]);
     currentDate = date.getMonth() + '/' + date.getDate() + '/' + date.getFullYear();


  var entity = cols[0]; // OK HEAD
  var currency = cols[1]; // OK LINE
  var taxcode = cols[2]; // SKIP
  var tranid = cols[3]; // OK HEAD
  var trandate = currentDate; // OK HEAD FORMAT 11/3/2016
  var location = 21;//cols[5]; // OK HEAD (ID of Location)
  var item = cols[6]; // OK LINE
  var quantity = cols[7];
  var rate = parseFloat(cols[8]); // FLOAT
  var amount = parseFloat(cols[9]);
  var po = cols[10];


  record.selectNewLineItem('item');

  // Head Level
  record.setFieldValue('createdfromstatus','');
  record.setFieldValue('entity', entity);
  record.setFieldValue('tranid', tranid);
  record.setFieldValue('trandate', trandate);
  record.setFieldValue('location', location);

  // Line Level
  record.setCurrentLineItemValue('item','item', item); 
  record.setCurrentLineItemValue('item','quantity', quantity); 
  record.setCurrentLineItemValue('item','rate', rate);
  record.setCurrentLineItemValue('item','amount', amount);
  //record.setCurrentLineItemValue('item','orderdoc', po);
  //record.setCurrentLineItemValue('item','podocnum', po);

  record.commitLineItem('item');   

  }

  var id = nlapiSubmitRecord(record, true);

  //trecord.setLineItemValue('item', 'amount', 1, 3 );
  //var idl = nlapiSubmitRecord(trecord, true);
}
</code></pre>

<p>Here is the example CSV file:</p>

<pre><code>Entity;Currency;Taxcode;Tranid;TranDate;Location;Item;Quantity;Rate;Amount;PO Internal ID
2449;USD;0.00 ;224676;11.3.2016;21;885;1;10;50;23664
2449;USD;0.00 ;224676;11.3.2016;21;870;2;10;120;23664
2449;USD;0.00 ;224676;11.3.2016;21;890;3;3;45;23664
2449;USD;0.00 ;224676;11.3.2016;21;948;4;4,66;38,5;23664
2449;USD;0.00 ;224676;11.3.2016;21;886;5;19,54;720;23664
</code></pre>

<p>I'm</p>