Wednesday, September 23, 2015

Remove Option Set Value at Runtime in CRM

function removeOptionSetValue(attributeName, value, index) {
 debugger;
var attrName = attributeName;
if (index != undefined && index != null) {
attrName = attrName + index;
index += 1;
}
else {
index = 1;
}
var attrControl = Xrm.Page.getControl(attrName);
if (attrControl != null) {
try {
attrControl.removeOption(value);
removeOptionSetValue(attributeName, value, index);
} catch (e) {}
}
}


function RemoveOptions()
{
removeOptionSetValue("optionsetName",value, null);
}