`salesOrder.selectNewLine({`         `//add a line...
# suitescript
g
salesOrder.selectNewLine({
        
//add a line to a sublist
        
sublistId: 'item' //specify which sublist
      
})
      
//get the internalID of the product from the name/id (vendorSKU)
      
var internalIdProduct = ''
      
var sr = SEARCH.create({
        
type: record.Type.INVENTORY_ITEM,
        
filters: ['itemid', 'is', prod.vendorSKU],
        
columns: ['internalId']
      
})
      
sr.run().each(function (result) {
        
internalIdProduct = result.getValue({
          
name: 'internalId'
        
})
      
})
      
log.debug('internalID: ' + internalIdProduct)
      
salesOrder.setCurrentSublistValue({
        
//set item field
        
sublistId: 'item',
        
fieldId: 'item',
        
value: internalIdProduct //replace with item internal id
      
})
      
salesOrder.setCurrentSublistValue({
        
sublistId: 'item',
        
fieldId: 'quantity',
        
value: prod.qty //replace with quantity
      
})
      
//repeat above pattern to set the rest of the line fields
      
salesOrder.commitLine({
        
//writes the line entry into the loaded record
        
sublistId: 'item'
      
})
      
salesOrder.save({
        
//writes record back to database
        
ignoreMandatoryFields: true //set for testing in case you want to create a record without validating which can give errors
      
})