2017-10-06 13 views
0

現在、アセンブリビルドのインベントリ詳細サブレコードのクライアント側スクリプトに関するトラブルが発生しています。ご存じのように、Assembly Buildsには2つの在庫詳細があります。右上隅にあるものは期待通りに機能し、私はすべてのフィールドにスイートスクリプトでアクセスできます。インベントリの割り当てサブライザがスイートスクリプトに反応しません

私は下部の在庫の詳細に問題があります。私はそれにアクセスすることができ、nlapiGetFieldValue()を使っています。しかし、私がサブリストにアクセスすると、私は 'id'の値を調べることしかできません。

これらは、「receiptinventorynumber」と呼ばれる文書化されていないフィールドとともに、存在するはずのフィールドです。ここで

List of inventory assignment fields

私のコードです:ここでは

//get the line items in the bottom inventory details 
var bottom_line_items = []; 
for(var line_index = 0; line_index < nlapiGetLineItemCount("component"); line_index++) 
{ 
    var bottom_inv_detail = nlapiViewLineItemSubrecord("component", 'componentinventorydetail', line_index+1); 
    if(bottom_inv_detail != null) 
    { 
     var bottom_line_count = bottom_inv_detail.getLineItemCount('inventoryassignment'); 
     for(var index =0; index < bottom_line_count; index++) 
     { 
      bottom_inv_detail.selectLineItem('inventoryassignment', index+1); 
      var sn = bottom_inv_detail.getCurrentLineItemValue('inventoryassignment', 'receiptinventorynumber'); 
      bottom_line_items.push(sn); 
     } 
    } 
} 
console.log(bottom_line_items); 

は、ブラウザのコンソールでそれを実行した結果である:

enter image description here

あなたが見ることができるように、 'ID' 、および 'internalid'の作業。 「receiptinventorynumber」はしません。他の分野のいずれも行いません。

私の使用例のため、サーバーにレコードが保存されるのを待つことができません。私はこのクライアント側をキャッチする必要があります。どんな提案も感謝しています。

答えて

1

私自身の質問にはちょうど答えることができましたが、サーバー側の検索が必要でした。私はそれが欲しかったように動作することは確かですが、まだテストしています。本質的に、私はidを持っていたフィールド 'issueinventorynumber'をつかんだ。そのIDは「インベントリシリアル番号」の内部IDで、実際の番号を取得するための検索を実行することができました。結果のコードは次のとおりです。

//get the line items in the bottom inventory details 
var bottom_line_ids = []; 
for(var line_index = 0; line_index < nlapiGetLineItemCount("component"); line_index++) 
{ 
    var bottom_inv_detail = nlapiViewLineItemSubrecord("component", 'componentinventorydetail', line_index+1); 
    if(bottom_inv_detail != null) 
    { 
     var bottom_line_count = bottom_inv_detail.getLineItemCount('inventoryassignment'); 
     for(var index =0; index < bottom_line_count; index++) 
     { 
      bottom_inv_detail.selectLineItem('inventoryassignment', index+1); 
      var sn = bottom_inv_detail.getCurrentLineItemValue('inventoryassignment', 'issueinventorynumber'); 
      bottom_line_ids.push(sn); 
     } 
    } 
} 

//do search to identify numbers of bottom serial numbers 
var columns = [new nlobjSearchColumn('inventorynumber')]; 
var filters = [] 
for(var index = 0; index < bottom_line_ids.length; index++) 
{ 
    filters.push(['internalid', 'is', bottom_line_ids[index]]); 
    filters.push('or'); 
} 
//remove the last 'or' 
if(filters.length > 0) 
{ 
    filters.pop(); 
} 
var search = nlapiCreateSearch('inventorynumber', filters, columns); 
var results = search.runSearch().getResults(0,1000); 
bottom_line_items = [] 
if(results.length != bottom_line_ids.length) 
{ 
    //if you get to this point, pop an error as the 'issueinventorynumber' we pulled is associated with multiple serial numbers 
    //you can see which ones by doing a 'Inventory Serial Number' Saved Search 
    //this is a serious problem, so we'd have to figure out what to do from there 
} 
for(var index = 0; index < results.length; index++) 
{ 
    bottom_line_items.push(results[index].getValue('inventorynumber')); 
} 
console.log(bottom_line_items); 
1

私はInventory Detailサブレコードで作業して以来、長い時間が経ちましたが、別のフィールドが 'assigninventorynumber'と考えられます。それを使ってみましたか?

+0

ナー、私はそれを試していませんでした。私はちょうど今それをテストしました。残念ながら、どちらもうまくいきませんでした。良い面では、私はちょうどいくつかの他のものを試しました...彼らは働くかもしれません。私は確かにあなたにそれに戻ってくるだろう=)。 –

関連する問題