The use-case of the scripts in the #ServivceNow #2
TheBharatha
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
1, SecurityGroupUsers.js
The task was to find those users who are members of group with type 'security'
Create a GlideRecord object with the table name used in your organization's instance. First query for the group.type Contains the sys_id of the group type. Then, query for active users and get their sys_ids into the array groupNames. Because the script returns an array of user's sys_id, we might have to use this with the sys_user table to match the results. Other settings include APIName: global.SecurityGroupUsers, Client callable: true, Active: true, Accessible from: This Application Only, Application: Global.
main.
2. MembersIntersections.js
The requirement was to find the users who are a members of at least one group, and those members who are not a member of the BASE ITIL Group
The way script works is, the first GlideRecord will first query for all the members in the BASE ITIL Group, and then use the second GlideRecord will query for all the members across all the other groups. The array of User's sys_ids from both Base ITIL group and other groups are pushed into two different arrays. At the end of the script, the ArrayUtil will take a difference between both the arrays, the result will be am array of the User's sys_ids who are not a member of Base ITIL Group.
#ServiceNow #The_Bharatha #JavaScript
Beta Was this translation helpful? Give feedback.
All reactions