2017-12-29 25 views
0

作成したフォームサブリストにデータを追加しようとすると、何かが見当たりません。 サブリストには、データの最初の行が入力されますが、それ以外は入力されません。
私はUIのリストオブジェクトを使用しようとしましたが、フォームとは別のようです。ここでの目標は、そのレコードに関連するいくつかのサブリスト(保存された検索に基づいて)を含むレコードを表示することです。Suiteletサブリスト(serverWidget.createform.addSublist)にデータ行を追加するには

助けがあれば助かります。

var mySearch = search1.load({ 
     id: 'customsearch511' 
     }); 
var resultSet = mySearch.run(); 
var list = form.addSublist({ 
      id: 'custpage_sublist', 
      type : serverWidget.SublistType.LIST, 
      label: 'Lines' 
     }); 
resultSet.columns.forEach(function(col){// This adds columns to the sublist based on the search results 
      list.addField({ 
        id: col.name, 
        label: col.label, 
        type: serverWidget.FieldType.TEXT 
        }); 
      }); 
for(var i in results){ 
    var result = results[i]; 
    for(var k in result.columns){ 
    var test = result.columns[k]; 
    if(result.getText(result.columns[k])){ //This is to get the values of any select field in the search 
     var fieldValue = result.getText(result.columns[k] 
     )} 
    else{ 
     var fieldValue = result.getValue(result.columns[k] 
     )}; 

    list.setSublistValue({ 
     id: result.columns[k].name, 
     value: fieldValue, 
     line: i      
     }); 
    //Error out after the first row is entered. When this loops back to the second line of the search results.   
    } 
context.response.writePage(form);  

答えて

0

をありがとうあなたは自分のコード内で小さな補正を行う必要があり、それは罰金になります。

var a=Number(i); 
sublist.setSublistValue({ 
id: result.columns[k].name, 
value: fieldValue, 
line: a 
}) 

;

私はテストして、うまくいきます。

幸運、 Mayur

関連する問題