Lock down change states for users with change_management role

ebaileyybs
Tera Expert

Hi,

I am looking to lock down certain states available for selection within the change state field. Please see below options;

find_real_file.png

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

35 REPLIES 35

Hi,



How would I set this so it shows state for change_management users? These users will also have the ITIL role.



Kind regards,


Emma


if(g_user.hasRole('itil') && !(g_user.hasRole('change_management')))


{


g_form.removeOption('state','approved')


g_form.removeOption('state','schedules')


//Others


}


-Anurag

Would this work for both scenarios?



1) User with ITIL licenese should only see states 1, 2 &3



2) User with change_management role should see all states


if(g_user.hasRole('itil') && !(g_user.hasRole('change_management')))


{//add all states that you want to remove


g_form.removeOption('state','approved')


g_form.removeOption('state','schedules')


//Others


}



This code will work in this way


1) all users who have ITIL but not change_management role will see only states 1, 2 &3


2) All users with change_management role, regardless whether they have ITIL or not, will see all states


-Anurag

Thank you, this works really well.



I would like this to only apply if the type of the change = Normal. How would i add this to the script please?