Lock down change states for users with change_management role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2015 05:07 AM
Hi,
I am looking to lock down certain states available for selection within the change state field. Please see below options;
I would like for 'ITIL' users to only be able to select the following states;
Draft
Review
Closed
Users with the change_management role should be able to select any of the above states.
Any help with this would be greatly appreciate.d
Kind regards,
Emma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2015 05:10 AM
You would need a onload client script or a UI policy and add or remove the options using g_form methods...
This should help
GlideForm (g form) - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2015 07:19 AM
I just implemented a similar requirement and here's the code from my Client Script.
I thought about changing it to meet your requirements, but then I have the risk that I miss something.
So, I am assuming that you can make the necessary adjustments to handle your situation.
If there's something not quite right, let me know. ( I wish I new how the experts paste in code that looks professional, maybe when I'm up to their level )
function onLoad() {
//If you're not a change manager and the approval is NOT CAB Approved, limit state options to Draft, Submitted or Cancelled
// ie. disallow WIP_PAT(5), WIP_PROD(6), Scheduled(2), Closed(8), Executed_Successfully(3), Executed_part_fail(4), Executed_fail(9)
if ( !g_user.hasRole('Change Manager') && ( g_form.getValue("approval") != "cab approved" ) )
{
g_form.removeOption('state', 5);
g_form.removeOption('state', 6);
g_form.removeOption('state', 2);
g_form.removeOption('state', 8);
g_form.removeOption('state', 3);
g_form.removeOption('state', 4);
g_form.removeOption('state', 9);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2015 05:13 AM
Use a On load Client Script to do this:-
if(g_user.hasRole('itil'))
{
g_form.removeOption('state', 'state value');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2015 05:14 AM
write an onload client script
if(g_user.hasRole('itil'))
{
g_form.removeOption('state','approved')
g_form.removeOption('state','schedules')
//Others
}