- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 07:21 AM
Hi everyone,
I have a requirement to hide a few request.states (not state) based on user role pm. Below are a couple client scripts I've attempted with no luck. The first script example is a copy of (BP) Hide Choice - Closed from incident table. Does anyone have any suggestions?
Thanks in advance for any feedback you can provide!
example 1
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 09:32 AM
It seems your are testing with admin user. To test whether the currently logged in user has the role "pm" explicitly assigned, use the hasRoleExactly() method
Please use below code and let me know,
Please mark my answer as helpful and accept it as the solution if it serves your purpose.
Thanks and Regards,
Krushna Birla
ServiceNow Consultant
LinkedIn

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 07:47 AM - edited 09-05-2023 07:48 AM
Hi,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 07:53 AM
thank you for the feedback. I think I passed it correctly, but I'm not 100% as this is not my specialty. The table is sc_request and the field name is request request_state

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 07:59 AM
What exactly are you trying to achieve here? Are the client scripts written on Incident table or Request table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 08:29 AM
The client script is written on the request table. All I want to do is hide a few request states if a user has a role pm. I can hide the states with a very basic client script below. However, when I add if the user has pm role the script doesn't hide it just for those particular users. The script below is hiding the states for everyone and it just needs to hide it for users with pm role. Hope that helps to explain better. thanks again for all the feedback