ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
スクリプトを使用し、配送に基づいて注文書に在庫詳細を入力する
適用
製品: NetSuite 2022.2
シナリオ
配送の在庫詳細を取得して、注文書の在庫詳細を記入する例コードは以下です。本例コードでアセンブリがある注文書を使用します。配送のレコード送信前機能のユーザーイベントスクリプトとして展開します。
解決策
例コード
SuiteScript 1.0
function beforeLoad_getInventoryDetails() { var count = nlapiGetLineItemCount('item'); //rec will store the subrecord values var rec = ""; //invcountは在庫割当のラインアイテム数を格納する var invcount = ""; //アイテムの配列は各ラインアイテムのシリアル番号と数量の値を格納する var items = new Array(); //全てのアイテムでループする for(var i=1; i <= count; i++ ) { rec= nlapiViewLineItemSubrecord('item', 'inventorydetail',i); invcount = rec.getLineItemCount('inventoryassignment'); //全ての在庫割当でループする //在庫詳細から値を取得する for(var x = 1; x <=invcount ; x++) { rec.selectLineItem('inventoryassignment', x); items[x] =[]; items[x][0] = rec.getCurrentLineItemValue('inventoryassignment', 'issueinventorynumber'); items[x][1] = rec.getCurrentLineItemValue('inventoryassignment', 'quantity'); nlapiLogExecution('DEBUG', i ,items[i][0] ); nlapiLogExecution('DEBUG', i ,items[i][1] ); } } // 注文書を開く var idSO = nlapiGetFieldValue('createdfrom'); var record2= nlapiLoadRecord('salesorder', idSO); var rec2 = 0