how to filter opened_by belongs to a specific group

tshk
Giga Contributor

On filter condition builder, Is there a way i can extract a list of users who belongs to a specific group?

I want to extract a list of users from user based on their group and use it in the workflow if activity. I'm doing something like this below but no luck - I'm new to scripting.

find_real_file.png

1 ACCEPTED SOLUTION

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

There is a scriptable class "GlideUserGroup" that has a method "getMembers" but you will still need a script include to get users Names rather than sys_id's. So one way or the other, still via a script include is the easiest way. Plus a script include can be used in other cases as well.


View solution in original post

7 REPLIES 7

varads_kulkarni
Giga Expert

Hi,


If I understand correctly, you need to find out if some task is opened by an user who belongs to specific group.


Correct me if I am wrong.



Best Regards,


Varad


Yes Varad, thats right.


sergiu_panaite
ServiceNow Employee
ServiceNow Employee

So, create a script include like below:



Screen Shot 2017-11-29 at 9.42.18 AM.png



and then on the list view use a filter like:



Screen Shot 2017-11-29 at 9.42.53 AM.png


When you run it the filter transforms into:



Screen Shot 2017-11-29 at 9.43.14 AM.png



Hope this helps.


Hi Sergiu,



i was able to write script in If activity itself and its running fine - similar to what you mentioned above.



I was looking to see if there is any direct use like how we use "javascript:gs.getUserID()" in condition builder for ease of use