title: Add New line item in Sales Order Using Suite Script 2.0
body: <p>I want to add new line item in Sales Order based on the particular Inventory item I select. The new line item should be loaded with the existing item record details in it. For this, I used the below code, but its not working;</p>
  
  <pre><code>function recalc(type)
  {
      var itemId = nlapiGetCurrentLineItemValue('item', 'item'); //Get the Item ID
      if(itemId == 16340) //Repair Cost
      {
          alert ("Hi");
          //Insert item
          nlapiSelectNewLineItem('item');
          nlapiSetCurrentLineItemValue('item', 'item', 330); //Repair Cost
          nlapiSetCurrentLineItemValue('item', 'quantity', 1);
          nlapiSetCurrentLineItemValue('item', 'amount', '0.00');
          nlapiCommitLineItem('item');
  
      }
      return true;
  }
  </code></pre>
  
  <p><strong>Can somebody help to rewrite the code in SS 2.0.</strong></p>