Welcome to OGeek Q&A 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 Reply

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...