UI Action Visibility Based on Assignment Group and Assigned To User

AbW
Tera Contributor

Need guidance on implementing a ServiceNow UI Action button on the Incident form with conditional visibility. The button should be visible only when the Incident is in an Active state, when the “Assigned To” field is populated, and only if the assigned user belongs to the same Assignment Group (for example, Hardware Group).

Whenever I am trying to add condition, I am not seeing the button  

 

current.active == true &&
!gs.nil(current.assigned_to) &&
gs.getUser().isMemberOf('hardware')

1 ACCEPTED SOLUTION

ridrepp
Tera Expert

Hi AbW, I was testing the condition you used in your case and when I found the incident that matches your condition and I was member of that group, it works for me:

UI Action Visibility - Screenshot 2.png

Could you please check if your setting of UI action looks similar to mine?
UI Action Visibility - Screenshot 1.png

The condition at the bottom of the setting is copy-paste of your condition.

 

View solution in original post

5 REPLIES 5

ridrepp
Tera Expert

Hi AbW, I was testing the condition you used in your case and when I found the incident that matches your condition and I was member of that group, it works for me:

UI Action Visibility - Screenshot 2.png

Could you please check if your setting of UI action looks similar to mine?
UI Action Visibility - Screenshot 1.png

The condition at the bottom of the setting is copy-paste of your condition.

 

AbW
Tera Contributor

Thanks. I was checking this condition as a system administrator who wasn't part of that group, so I didn't realize I needed to impersonate the 'assigned_to' member. Once I did, it worked as expected 😅

AbW
Tera Contributor

It worked 

Ankur Bawiskar
Tera Patron

@AbW 

update as this

current.active == true && !gs.nil(current.assigned_to) && gs.getUser().getUserByID(current.assigned_to).isMemberOf(current.assignment_group)

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader