The CreatorCon Call for Content is officially open! Get started here.

Hide Assign to Me UI Action if user is not part of current assignment group.

jason_lindsey
Kilo Contributor

I'm trying to hide the Assign to Me UI Action in sn_customerservice to where it will only show after an Assignment Group is selected and if the current user is a member of the Group. I have tried using  gs.getUser().isMemberOf(current.assignment_group) as the condition but it is not working. I can use an OnChange client script to do this but it does not work if the Assignment Group field is empty. Does anyone know of another UI Action condition that would solve this?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

isMemberOf() uses a display name, so try this instead...



gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())


View solution in original post

6 REPLIES 6

Chuck Tomasi
Tera Patron

isMemberOf() uses a display name, so try this instead...



gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())


nthumma
Giga Guru

use like this "gs.getUser().isMemberOf(current.assignment_group.name.toString()))"


Capture.PNG


Best practice is to use getDisplayValue() rather than dot-walk to the name field. While they are the same value most of the time, it isn't absolutely certain in every case.



See section 5.5 here: http://wiki.servicenow.com/index.php?title=Coding_Best_Practices#Use_getDisplayValue.28.29_Effective...


Hi Chuck, how would i add the condition to only show if the assigned to is not me or empty



I have tried this... but not working. !current.assigned_to == gs.getUserID();