- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 01:45 AM
Hi all,
I'm relatively new to ServiceNow, but i have created an internal Service Portal for change requests to be processed. The problem i'm having is that the state field is showing all options available to the users, even though the client script 'Show valid state values' has been switched to run in all ui types. Can anyone tell me why its not working on the Service Portal but it is in the standard ui?
Many thanks in advanced for your help!
Service Portal:
Standard UI:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 07:07 AM
So I finally got this working, and thank you to Michael for your help.
I created a new onLoad client script that removes the unwanted states.
Make sure to set the UI Type to Mobile / Service Portal
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('state') == '-5')// For state use your database value and same for other states
{
g_form.removeOption('state', '-3');
g_form.removeOption('state', '-2');
g_form.removeOption('state', '-1');
g_form.removeOption('state', '0');
g_form.removeOption('state', '3');
g_form.removeOption('state', '4');
}
}
repeat as necessary through all the state values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2017 05:07 AM
The onload client script calls several script includes that uses the Change type to determine which States are available for that type. I doubt you can get it working using the desktop scripts. You'll probably have to write your own script to get the correct state values based on type, then use client script to show 2 values, the current state, and future state.
Is the goal to allow users to work their change requests? I'd check with your sales rep before doing that to make sure licensing allows for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 07:07 AM
So I finally got this working, and thank you to Michael for your help.
I created a new onLoad client script that removes the unwanted states.
Make sure to set the UI Type to Mobile / Service Portal
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('state') == '-5')// For state use your database value and same for other states
{
g_form.removeOption('state', '-3');
g_form.removeOption('state', '-2');
g_form.removeOption('state', '-1');
g_form.removeOption('state', '0');
g_form.removeOption('state', '3');
g_form.removeOption('state', '4');
}
}
repeat as necessary through all the state values.