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

Can you create a dynamic group?

robpickering
ServiceNow Employee
ServiceNow Employee

Haven't really had a reason for this before, but can you create a dynamic group in ServiceNow based off of characteristics on a User record?

We have a custom field on the User records called "Is Manager".   I'd like to have a group in ServiceNow that contains all of those people and adds or removes people dynamically from it.

 

If there isn't functionality OOB, would you just build a Business Rule that adds and removes people from the group based on changes to the user records?

1 ACCEPTED SOLUTION

jshatney
Mega Expert

Agree with James.



Create a business rule on the sys_user table to check the flag that you have created for "Is Manager".



If the value is true, run a Glide query to check the group membership table (sys_user_grmember) to see if they user already exists. If not, create a new record.
If the value is false, run a Glide query (same as above) and remove the record if they exist in the table.


View solution in original post

7 REPLIES 7

jfarrer
Mega Guru

I've typically done this using a business rule that checks for changes to the field on the user record (or whatever the criteria would be).


jshatney
Mega Expert

Agree with James.



Create a business rule on the sys_user table to check the flag that you have created for "Is Manager".



If the value is true, run a Glide query to check the group membership table (sys_user_grmember) to see if they user already exists. If not, create a new record.
If the value is false, run a Glide query (same as above) and remove the record if they exist in the table.


poyntzj
Kilo Sage

Just being nosey, but what is the purpose of the group ?



We control everything via LDAP groups, but I can see some uses for an option like this



Cheers


robpickering
ServiceNow Employee
ServiceNow Employee

Julian, in our instance we don't import our LDAP groups and keep them local in ServiceNow. It cuts WAY down on overhead of managing everything for us (we have over 400 AD groups, most which don't align the way we want to organize in ServiceNow).



That said, we wanted to limit some Catalog items specifically to Managers, but I don't want to manage the Managers group, so this seemed like a logical way of handling it.