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

Tanushree Maiti
Tera Patron

Hi @AbW 

 

try this:

 

  • Name: Give your UI Action a name (like Assign to Me)
  • Table: Incident
  • Show insert: Checked
  • Show update: Checked
  • Client: Checked
  • Condition: current.active == true && !current.assigned_to.nil() && gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())
  • Script:

function customActionFunction()

{   

// Add your business logic here   

gs.addInfoMessage("Action processed successfully.");  

  current.update();

}

if (typeof window == 'undefined')

{   

customActionFunction();

}

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti