Reputation: 83
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 i.e. 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.
Upvotes: 0
Views: 17800
Reputation: 83
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);
}
}
Upvotes: 0