how to get price from princing in Netsuite SuiteScript

       

   var record = nlapiLoadRecord(RecordType, itemInternalID);
 var pricelevel=1;
 var itemCount = record.getLineItemCount('price1');
 
 if(itemCount>0){
      for(var line=1; line<=itemCount; line++){
      
          var pricelevelFind = record.getLineItemValue('price1', 'pricelevel', line);  
          
          if(pricelevelFind == pricelevel){
          pricelevel=  line;
 break;
          }
          
      }
     }

 var price1=  record.getLineItemMatrixValue('price1', 'price', pricelevel, 1); 
 var price2=  record.getLineItemMatrixValue('price1', 'price', pricelevel, 2); 
 var price3=  record.getLineItemMatrixValue('price1', 'price', pricelevel, 3); 
 var price4=  record.getLineItemMatrixValue('price1', 'price', pricelevel, 4); 
 var price5=  record.getLineItemMatrixValue('price1', 'price', pricelevel, 5);


price1 is generally USD, price2 may be something else.. price1, price2, price3 denotes currency in NetSuite. 

var pricelevelFind = record.getLineItemValue('price1', 'pricelevel', line);

Here we count the total number of line items because record.getLineItemMatrixValue('price1', 'price', 1, 1); 

takes rows and columns from the price matrix. getLineItemMatrixValue returns price from first row and first column of price matrix. 


Comments

Popular posts from this blog

What are sales territory in Netsuite?

How to get and set a sublist in netsuite suitlet suitescript 2.0