Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

netsuite - how to access the inventory details of an item master record using suitescript 1.0?

I need to just get the Qty on hand, qty on order, qty backordered, under which bin number the item is, value and avg. cost of an item. Just need to show this to my manager in a normal text field. I tried to do it from search, but the values were not according to the inventory details.

My manager is saying me not to use search and use loading the subrecords but i couldn't find any idea for loading subrecords.

My Current code on client script:

function pageInit() {

   var itemSearch = nlapiSearchRecord("item", null,
    [
      ["name", "haskeywords", "ZE001156"],
    ],
    [
      new nlobjSearchColumn("itemid").setSort(false),
      new nlobjSearchColumn("displayname"),
      new nlobjSearchColumn("location"),
      new nlobjSearchColumn("quantityonhand"),
      new nlobjSearchColumn("quantityonorder"),
      new nlobjSearchColumn("quantitybackordered"),
      new nlobjSearchColumn("averagecost"),
      new nlobjSearchColumn("binnumber")
    ]
  );
  nlapiLogExecution('DEBUG', 'itemSearch', JSON.stringify(itemSearch));
  nlapiLogExecution('DEBUG', 'itemSearch.length', itemSearch.length);
  if (itemSearch.length > 0) {
    for (var i = 0; i < itemSearch.length; i++) {
      var srchLine = itemSearch[i];
      var onHand = srchLine.getValue('quantityonhand');
      nlapiLogExecution('DEBUG', 'on hand:' + i, onHand);
      var onOrder = srchLine.getValue('quantityonorder');
    }
  } 
}
question from:https://stackoverflow.com/questions/65885283/how-to-access-the-inventory-details-of-an-item-master-record-using-suitescript-1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...