Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2018 09:29 AM
What is the best way to change drop down options when user changes the view?.
ex when user Change the view on the incident from self - service to different view show in a drop down field different options to select from .
Thanks
Solved! Go to Solution.
Labels:
- Labels:
-
Incident Management
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 09:58 AM
Other things is more intresting .
You can try with this .
Becouse this is i have tried.
Although as the whole thread says...addOption, clearOptions and removeOption are the best way to go and i totally agree to that. As far as performance is concerned these functions don't have any noticeable impact. These are service now methods to browser dependency and upgrade support is also there OOB.
Still if you want another option.. here is a code by sanjay bagri..This code doesn't remove the option but disable it, options will be there but user wont be able to select them.
disableOption();
function disableOption()
{
var fieldName = 'u_status';
var control = g_form.getControl(fieldName);
if (control && !control.options)
{
var name = 'sys_select.' + this.tableName + '.' + fieldName;
control = gel(name);
}
if (!control)
return;
if (!control.options)
return;
var options = control.options;
for (var i = 1; i < options.length; i++)
{
var option = options[i];
alert('hello'+ options[i].value);
if(g_user.hasRole('itil') && (options[i].value == "Draft" || options[i].value == 'Review' || options[i].value == 'Closed'))
{
control.options[i].disabled = 'true';
}
}
}
Please remember it mark it as correct and also helpful .
Gaurented it will help you . Becose same thing i have done . In our project recently.
Thanks
Sanjay Bagri
7 REPLIES 7

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 09:58 AM
Other things is more intresting .
You can try with this .
Becouse this is i have tried.
Although as the whole thread says...addOption, clearOptions and removeOption are the best way to go and i totally agree to that. As far as performance is concerned these functions don't have any noticeable impact. These are service now methods to browser dependency and upgrade support is also there OOB.
Still if you want another option.. here is a code by sanjay bagri..This code doesn't remove the option but disable it, options will be there but user wont be able to select them.
disableOption();
function disableOption()
{
var fieldName = 'u_status';
var control = g_form.getControl(fieldName);
if (control && !control.options)
{
var name = 'sys_select.' + this.tableName + '.' + fieldName;
control = gel(name);
}
if (!control)
return;
if (!control.options)
return;
var options = control.options;
for (var i = 1; i < options.length; i++)
{
var option = options[i];
alert('hello'+ options[i].value);
if(g_user.hasRole('itil') && (options[i].value == "Draft" || options[i].value == 'Review' || options[i].value == 'Closed'))
{
control.options[i].disabled = 'true';
}
}
}
Please remember it mark it as correct and also helpful .
Gaurented it will help you . Becose same thing i have done . In our project recently.
Thanks
Sanjay Bagri
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2018 07:34 AM
Thanks that was really helpful

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2018 11:25 AM
Tq .
I got help from your answers.