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

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



}



}


     


}      


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....


find_real_file.png


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');    





}



}


   


}    


-Anurag

Hi, I am now getting the following error message when I load the change form.




find_real_file.png