2017-02-21 62 views
0

在UI中,我使用供應商線創建了自定義事務搜索。我如何訪問供應商行值?我有這樣的事情:如何從netsuite中的自定義搜索結果訪問字段?

 var veResults = vendorSearch.run().getRange({ 
     start: 0, 
     end: 50 
     }); 
     for(var i = 0; i < veResults.length; i++) 
     { 
      var vendorName = veResults[i].getValue({name: 'vendorLine.entityid'); 
      context.response.write(vendorName); 
     }; 

如果我打印veResults,我得到以下JSON:

[ 
{ 
    "recordType": "vendorpayment", 
    "id": "210", 
    "values": { 
     "employee.entityid": "", 
     "trandate": "5/20/2015", 
     "print": "Print", 
     "type": [ 
      { 
       "value": "VendPymt", 
       "text": "Bill Payment" 
      } 
     ], 
     "payrollbatch": "", 
     "tranid": "2009", 
     "entity": [ 
      { 
       "value": "35", 
       "text": "Pacific Bell Telephone" 
      } 
     ], 
     "account": [ 
      { 
       "value": "1", 
       "text": "1000 Checking" 
      } 
     ], 
     "otherrefnum": "", 
     "statusref": [], 
     "trackingnumbers": "", 
     "memo": "", 
     "currency": [ 
      { 
       "value": "1", 
       "text": "USA" 
      } 
     ], 
     "expectedreceiptdate": "", 
     "trandate_1": "5/20/2015", 
     "enddate": "", 
     "item": [], 
     "vendorLine.entityid": "Pacific Bell Telephone", 
     "vendorLine.billaddress": "Pacific Bell Telephone\nPacific Bell Payment Center\nSacramento CA 95887-0001\nUS" 
    } 
    ...] 

所以,價值是存在的,我怎麼得到它?搜索對象只有getValue和getText方法,在這種情況下,這些方法都不起作用。

回答

1

沒有與此行

var vendorName = veResults[i].getValue({'vendorLine.entityid'); 

一個語法錯誤,它應該是

var vendorName = veResults[i].getValue('vendorLine.entityid'); 
+0

是,sorrry我的壞 - 在{}當您使用name屬性,這是我缺乏在我的片段。像這樣:var vendorName = veResults [i] .getValue({name:'vendorLine.entityid'});,它與var vendorName = veResults [i] .getValue('vendorLine.entityid');相同。儘管如此,這兩種方法都無效。 – user2187935

+0

嘗試veResults [i] .getValue({name:'entityid',join:'vendorLine'}) –

+0

是的,你是對的。連接屬性做了一個詭計,奇怪的是,這是我嘗試的第一件事情之一,沒有工作,並轉移到別的東西上:/謝謝。 – user2187935