- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 03:13 AM - edited 04-18-2024 03:25 AM
Hello experts,
I want to create a scripted filters on user table for showing user which having the "Itil" role.
I have taken the help from https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/using-lists/task/t_...
I created below script include:
Please help on that.
Thank You!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 04:52 AM - edited 04-18-2024 04:54 AM
Hi @Chandra18 ,
Please Remove all the content of the script and just keep below script or your script will also work
function myFunction(){ var arrUsers = []; gr = new GlideRecord('sys_user_has_role'); gr.query('role', '282bf1fac6112285017366cb5f867469');//itil role sys_id while (gr.next()) { arrUsers.push(gr.user.toString()); } return arrUsers; }
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 10:28 PM
Hi @Chandra18 ,
Please refer below code
gr.query('role.name', 'itil');
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 05:45 AM - edited 04-18-2024 05:46 AM
Hi @Chandra18 ,
Why not using the OOTB table sys_user_has_role with appropriate conditions?
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/