Remove Optionset Value at Runtime – MS CRM 2011

Remove Optionset Value at Runtime – MS CRM 2011

Create Js webresource with below code.

function removeOptionSetValue(attributeName, value, index) {
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);

}

so it will remove the value from optionset.

Happy Coding

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s