Syntax for a condition on a UI action

velvet
Mega Guru

I have a ui action that pages the on-call person based off the assignment group of the incident.  It will page the on-call person for a on-call schedule that is using  that assignment group.  Some assignment groups are not on-call so I want to exclude those groups.  So on the ui action, how can i exclude 4 groups, so that the ui button does not show when these groups are assigned to the incident.  Groups A, B, and C.

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

You could add a new True/False field called "On call" to the Group table and use that in your condition:

find_real_file.png

Tag all your on call groups by setting the field to "true".  Easier to maintain with a checkbox instead of changing code to make the UI Action appear or not for the groups.  Your condition could then be:

current.priority == 1 && current.assignment_group.u_on_call == true

Another way of doing it would be with the "Type" field on the Group table, and adding a Type of "On call".  But that could be a bit of a pain depending on how things are configured in your instance.  OOB, the Assignment group field on Task has a reference qualifier of:

find_real_file.png

To me, that's a mistake.  The default reference qualifier should be blank, and any overrides should be in Dictionary override records for the appropriate tables.

Personally, I would go with the "Type" field as it gives you a lot of flexibility, but it might take a bit to get all your groups setup and working properly in all the different task tables.  That's why I like to do it right from the start of an implementation.  The new "On call" field, however, makes it quick to add what you need now.

View solution in original post

15 REPLIES 15

Steven Parker
Giga Sage

This is the "isMemberOf" syntax you can use:

!gs.getUser().isMemberOf('Support Center Team') || !gs.getUser().isMemberOf('Active Directory Team')

That should exclude Support Center Team or Active Directory Team if the user is a member of that Team.

 

OR if you just want to exclude it from the Assignment Group, it should be something like this:

!current.assignment_group == 'sys_id_of_assignment_group'


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

I added the line for the group and now the button is not there at all

 

current.priority == 1 && !current.assignment_group.nil() &&!current.assignment_group == 'c30aeac7dbb68300c7e57afc0f961960'

It's the syntax of your condition (bolded below). Partly my fault for providing the == and not the != syntax. Probably could have still used sys_ids with the !=, but it's easier to follow when you use the actual groups name with .getDisplayValue() instead of sys_ids:

current.priority == 1 && !current.assignment_group.nil() && current.assignment_group.getDisplayValue() != 'GROUP NAME'

Example from my test instance:

current.priority == 1 && !current.assignment_group.nil() && current.assignment_group.getDisplayValue() != 'Network Team'


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Velvet did you try this?  It works...I tested it in my personal instance:

current.priority == 1 && !current.assignment_group.nil() && current.assignment_group.getDisplayValue() != 'Cogito'

Just keep adding && and groups to it as needed


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven