Dynamics Crm2011 Removes an option from an Option Set control

Application scenarios: OptionSet there are N option values, under certain conditions, need to remove some display option, such option to me two red box does not display under certain conditions


var purchasetype= Xrm.Page.getControl("new_purchasetype");
var option=Xrm.Page.getAttribute("new_purchasetype").getOptions();
for (i=0; i<option.length;i++ )
{
  if (option[i].value=='100000004'||option[i].value=='100000005'||option[i].value=='100000006')
  {
      purchasetype.removeOption(option[i].value);
   }
}
Implementation of the results shown in Figure

The SDK instructions below, with particular attention here in parentheses parameter number, the value is the value of the option but not an option itself.


Reproduced in: https: //www.cnblogs.com/VicTang/p/3808986.html

Guess you like

Origin blog.csdn.net/weixin_34037977/article/details/93416732