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

Script to get Groups

Rick27
Tera Contributor

Hi guys, I'm new to servicenow. I have a catalog to add/remove users from groups, but I would like to put an option when the user selects a group of type "Approvers" to appear in a read-only list all the approving groups that it is already included, I know how to do the query to get these groups but I'm lost on how to make an ajax script and a client script calling it to do this function, can anyone guide me?

4 REPLIES 4

Anil Lande
Kilo Patron

Hi,

Please check below link to learn more about GlideAjax.

https://community.servicenow.com/community?id=community_article&sys_id=9f7ce2e1dbd0dbc01dcaf3231f961...

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

ccajohnson
Kilo Sage

Are you trying to restrict what list of groups are shown to select? You do not need an Ajax call, but you can use a script include to hold the filtering logic. Let me know what you are trying to accomplish (variable values, group attributes, etc.) so we can narrow our solution accordingly.

Thanks for the answer, I would like to show a variable with all the groups of type "Approver" that the user has, because when he selects a new group of the same type, I want to ask him if he wants to leave one of those approval groups he has is already included

Help me to understand the full scope of the ask. It sounds like there is a policy that limits the number of approval groups a person can belong to. Is this correct? Is there any reason why a user must select a group to be added to as well as to be removed from? This seems to overcomplicate the procedure a user would need to do in order to submit.