1

我想隱藏Field Service - Dynamics 365應用程序上的Optionset值。我們正在使用Woodford解決方案進行定製。基於Resco Javascript Bridge Reference,我沒有看到隱藏現有選項集中選項的方法。所以我創建了一個ComboBox並試圖將選項添加到ComboBox中。但即使我在ComboBox上添加了錯誤的標籤,也添加了多個選項,但它僅顯示一個選項。隱藏Resco Mobile CRM中的選項

if ((responseTypeOptionSetValues.length == responseTypeOptionSetLables.length) 
     && responseTypeOptionSetLables.length > 0) { 
    for (i = 0; i < responseTypeOptionSetValues.length; i++) { 
     if (valueListOptions.length > 0) { 
      for (i = 0; i < responseTypeOptionSetValues.length; i++) { 
       if (valueListOptions.indexOf(responseTypeOptionSetValues[i].toString()) != -1) { 
        finalLabelValue = responseTypeOptionSetLables[i].toString(); 
        finalOptionValue = responseTypeOptionSetValues[i].toString(); 
        comboItem.listDataSource = { 
         **finalLabelValue: finalOptionValue,** 
           }; 
       } 
      } 
     } 
    }     
} 

回答

1
var data = new Object(); 

if ((responseTypeOptionSetValues.length == responseTypeOptionSetLables.length) && responseTypeOptionSetLables.length > 0) { 
    for (i = 0; i < responseTypeOptionSetValues.length; i++) { 
     if (valueListOptions.indexOf(responseTypeOptionSetValues[i].toString()) != -1) { 
      finalLabelValue = responseTypeOptionSetLables[i].toString(); 
      finalOptionValue = responseTypeOptionSetValues[i].toString();      
      data[finalLabelValue] = finalOptionValue; 
     } 
    } 
} 
if (!isComboItemExists) { 
    comboItem.listDataSource = data; 
    detailView.insertItem(comboItem, -1); 
} 
else { 
    comboItem.listDataSource = data; 
} 
0

你正在用相同的變量名嵌套你的循環。給每個循環一個獨特的變量:i,j,k ...