How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013
This code will help you………………
function dynamicoptionset() {
//get value in no in variable
var totaldivision = Xrm.Page.getAttribute(“fieldname” ).getValue();
if (totaldivision == null || totaldivision == “” )
return;
var optionsetControl = Xrm.Page.ui.controls.get( “new_division” );
var options = optionsetControl.getAttribute().getOptions();
optionsetControl.clearOptions();
for ( var i = 0; i < totaldivision; i++) {
optionsetControl.addOption(options[i]);
}
}
}
SOURCE : mscrm.com