I want to restrict the accessibility of Re-Assess button for ITIL Users on a problem task.

Raahul2
Tera Contributor

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')

 

 

1 ACCEPTED SOLUTION

Viraj Hudlikar
Tera Sage

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.

View solution in original post

10 REPLIES 10

Hi @Raahul2 

 

I try to add the ITIL role and now you can do 

 

AGLearnNGrow_0-1739962018476.png

AGLearnNGrow_1-1739962058511.png

 

 

 

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]

****************************************************************************************************************