- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 03:21 AM
Hi,
Is it possible to make one value in State "read only". What im trying to accomplish is to make State "New" read only for incident, so that this state isn't possible to set manually, only by rules..
Anyone tried anything similar?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 03:25 AM
Sorry Anders. It's a function of most browsers that choice lists (aka select lists) display the values they have. You could use an onLoad client script to remove the option.
g_form.removeOption('state', 'New'); //Adjust New to the proper state VALUE, e.g. 1)
Reference:
GlideForm (g form) - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 03:44 AM
If the objective is to make the entire field read-only given a certain condition (state == 1, for example) I strongly recommend a UI policy for easier maintenance.
Creating a UI Policy - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 06:37 AM
Hi,
You can use below Onload client script-
(1=New, Rest you can use as per your state value if required )
var s = g_form.getValue('state');
if(s != '1')
{
g_form.removeOption('state', '1');
}
else if (s == '1')
{
g_form.removeOption('state', '3');
g_form.removeOption('state', '4');
}
Thankyou