working on a tutorial at home with Microsoft Dynamics 365 CRM, to hide a Option Set Value from a dropdown, however this dropdown also is used on a Business Process Flow, I dont want to delete the Option Set Value, just hide it ie removeopotion/hide.
Im trying to use JavaScript to hide/remove this, however Im very new to JS and dont really understand it, my code is below:
function hideOptions(executionContext) {
var formContext = executionContext.getFormContext();
if (formContext.ui.getFormType() == 1 || formContext.ui.getFormType() == 2 ) {
var pickList = formContext.Page.getControl("statuscode");
pickList.removeOption("Test1");
pickList.removeOption("Test2");
pickList.removeOption("Test3");
pickList.removeOption("Test4");
}
}
Please advise.
You should provide the numeric value in the removeOption
method.
As it's said in microsoft docs
formContext.getControl(arg).removeOption(value);
value - Number - The value of the option you want to remove.
I fixed this now thank you guys, was missing the correct schema name name "header_statuscode"
function hideOptions(executionContext) {
var formContext = executionContext.getFormContext();
if (formContext.ui.getFormType() == 1 || formContext.ui.getFormType() == 2 ) {
var pickList = formContext.getControl("header_statuscode");
pickList.removeOption(1);
pickList.removeOption(2);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.