Hide 'New' button on Incident List view

Rocky5
Kilo Sage

Hello Experts,

 

I want to hide 'New' button on incident list view for all non-ITIL users. And I have configured the list control as below.

 

Rocky5_0-1665666082865.png

 

But, when impersonated as non - ITIL user, they can still see the 'New' button but when clicked they see this error. 

 

Rocky5_1-1665666156103.png

 

Rocky5_2-1665666176358.png

 

Any input or suggestions to hide 'New' button for all 'Non - ITIL' users.

 

Thanks,

Rocky.

 

1 ACCEPTED SOLUTION

Take a look at this UI Action

 

instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=c9ce66b4d703120060faef637e610334

 

If a user doesn't have the ITIL role, it's trying to redirect them to the OOTB create incident record producer (line 14). My guess is you have the RP disabled and that's why they get the error message.

 

You can add an && condition to the condition field so the button only appears for ITIL - && gs.hasRole('itil,sn_incident_write')

 

 

(new GlideRecord(current.getTableName())).canCreate() && !RP.getListControl().isOmitNewButtonWithoutChecks() && !RP.isRelatedList() && gs.hasRole('itil,sn_incident_write')

View solution in original post

4 REPLIES 4

Mike_R
Kilo Patron
Kilo Patron

Are you sure that the person you are impersonating doesn't have the itil role? They could've inherited the role through another role.

 

Check this link to search if they have the itil role

instanceName.service-now.com/sys_user_has_role_list.do?sysparm_query=role%3D282bf1fac6112285017366cb5f867469&sysparm_view=

Yes the user has only the custom role I created. 

 

Thanks,

Rocky.

Take a look at this UI Action

 

instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=c9ce66b4d703120060faef637e610334

 

If a user doesn't have the ITIL role, it's trying to redirect them to the OOTB create incident record producer (line 14). My guess is you have the RP disabled and that's why they get the error message.

 

You can add an && condition to the condition field so the button only appears for ITIL - && gs.hasRole('itil,sn_incident_write')

 

 

(new GlideRecord(current.getTableName())).canCreate() && !RP.getListControl().isOmitNewButtonWithoutChecks() && !RP.isRelatedList() && gs.hasRole('itil,sn_incident_write')

Musab Rasheed
Tera Sage
Tera Sage

Hello,

I guess easiest way to do is to modify 'create' ACL on Incident table and include "ITIL" under roles, In my opinion this should be easiest solution but give a try.

Please hit like and mark my response as correct if that helps
Regards,
Musab