- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 01:15 AM
The Re-Assess button is an OOB UI Action on the PTask. I want to restrict the access and visibility for ITIL users. Tried the condition in the UI action but did not work. I am trying to have the access only for the Assigned group members and assigned group manager. No ITIL user should have access to the button,
Condition used :
new ProblemTaskStateUtils().isAllowedToReAssess(current) && current.state == 154 || current.state == 157 && (gs.getUser().isMemberOf(current.assignment_group) || gs.getUserID() == current.assignment_group.manager) && !gs.getUser().hasRole('itil')
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 01:35 AM
Hello @Raahul2
It looks like there might be an issue with the logical operators and the grouping of conditions. Here's a revised version of your condition:
(new ProblemTaskStateUtils().isAllowedToReAssess(current) &&
(current.state == 154 || current.state == 157) &&
(gs.getUser().isMemberOf(current.assignment_group) || gs.getUserID() == current.assignment_group.manager) &&
!gs.getUser().hasRole('itil'))
By grouping the conditions with parentheses, you ensure that the logic is evaluated correctly. Apply this condition to the UI Action and test it to see if it works as expected.
If you still encounter issues, you might want to add some logging to debug the condition. For example:
gs.log("User: " + gs.getUserID() + ", isMemberOf: " + gs.getUser().isMemberOf(current.assignment_group) + ", isManager: " + (gs.getUserID() == current.assignment_group.manager) + ", hasRole: " + gs.getUser().hasRole('itil'));
This will help you understand which part of the condition might be failing.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 02:48 AM
Hi @Raahul2
I try to add the ITIL role and now you can do
Give a try at your end.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************