How do I hide a category an incident form if user does not have the 'admin' or 'iGate' role.

kevinwhittaker
Tera Contributor

I want to hide 'SAP / Application Problem' from showing up in the incident drop down for the Category field if you don't have the 'admin' or 'iGate' roles.   The value for SAP / Application is 'sap_application_support'.   I'm trying to use a client script on Load to remove this value.   The script that is not working is below...I'm still learning how to use Javascript and have only been involved in using SNOW for about 6 months.   Any help is greatly appreciated in advance...thank you!

2015-10-15_14-44-17.png

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

You don't have to explicitly call admins if you use hasRole.   admins automatically have every role.   If you use hasRoleExactly, you would.   So, I would do:



if(!g_user.hasRole('iGate')){


        g_form.removeOption('category', 'sap_application_support');


}


and that should suffice.


View solution in original post

6 REPLIES 6

OK next question Mike...how do I mark your answer as correct so you get credit?


There should just be two buttons below each answer, one stating Helpful and one stating Correct.