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

How to check if a group has members

johannes5
Giga Expert

Hi ServiceNow Community Developers,,

I would like to check if an assignment group has members before assigning a ticket to it and issue an error message if it does not. I can easily write a script include to do this but I was wondering if there in as OOB function that I can call to do this checking for me. Please asdivse.

Thanks,

Johannes

1 ACCEPTED SOLUTION

jcote
Giga Expert

Hi Johannes,



I do not believe there is OOB functionality to perform the exact behavior you're asking for.



Just a couple of ideas:


1) You could perform a GlideAjax call to the "sys_user_grmember" table to see if there are any records returned for the entered group- and if not then you could then throw the error on the client.



2) You could also utilize an Advanced Reference Qualifier at the Dictionary level of the Assignment group field (be aware you'll likely want to do a dictionary override here) to just not include any Groups that have zero users.



Hope this helps.


View solution in original post

2 REPLIES 2

jcote
Giga Expert

Hi Johannes,



I do not believe there is OOB functionality to perform the exact behavior you're asking for.



Just a couple of ideas:


1) You could perform a GlideAjax call to the "sys_user_grmember" table to see if there are any records returned for the entered group- and if not then you could then throw the error on the client.



2) You could also utilize an Advanced Reference Qualifier at the Dictionary level of the Assignment group field (be aware you'll likely want to do a dictionary override here) to just not include any Groups that have zero users.



Hope this helps.


Thanks Jamison, I thought as much but I wanted to double check with the community first.



Johannes