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-06-2015 05:29 AM
function onChange() {
if(!isLoading)
{
if(newValue=='Normal') //adding condition for type
{
if(g_user.hasRole('itil') && !(g_user.hasRole('change_management')))
{//add all states that you want to remove
g_form.removeOption('state', '-4');
g_form.removeOption('state', '-3');
g_form.removeOption('state', '-2');
g_form.removeOption('state', '2');
g_form.removeOption('state', '-1');
//Others
}
}
else if(newValue!='Normal')
{
g_form.addOption('state');
g_form.addOption('state', '-4');
g_form.addOption('state', '-3');
g_form.addOption('state', '-2');
g_form.addOption('state', '2');
g_form.addOption('state', '-1');
//Add all options
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2015 05:34 AM
this would not work if the user switches back and forth between the types , choices displayed will be trash .. So clear the options and add the options based on the condition....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2015 05:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2015 05:37 AM
this should work
function onChange() {
if(!isLoading)
{
if(newValue=='Normal') //adding condition for type
{
if(g_user.hasRole('itil') && !(g_user.hasRole('change_management')))
{//add all states that you want to remove
g_form.removeOption('state', '-4');
g_form.removeOption('state', '-3', '');
g_form.removeOption('state', '-2');
g_form.removeOption('state', '2');
g_form.removeOption('state', '-1');
}
}
else if(newValue!='Normal')
{
g_form.clearOptions('state');
g_form.addOption('state', '-4', 'Approval Requested');
g_form.addOption('state', '-3', 'Approved');
g_form.addOption('state', '-2', 'Scheduled');
g_form.addOption('state', '2', 'In Progress');
g_form.addOption('state', '-1' , 'Completed');
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2015 06:00 AM