What This Table Is
The sys_user_grmember table is the junction table that establishes many-to-many relationships between users (sys_user) and groups (sys_user_group). Every group membership in ServiceNow—whether it's ITIL roles, assignment groups, or custom groups—creates a record here. This table is the authoritative source for determining what groups a user belongs to and which users are in a specific group.
This table is owned by the Platform module and supports virtually every security and workflow process in ServiceNow. Access controls, assignment rules, approval workflows, and notification schemes all depend on group membership data stored here. The table doesn't extend any parent table—it's a straightforward data table with foreign key relationships to users and groups.
Record volume scales dramatically with organization size. A 10,000-user enterprise typically has 50,000-100,000 group membership records. Users often belong to 5-15 groups on average (department, location, ITIL roles, project teams), while some power users or service accounts can have 50+ group memberships. The platform maintains historical records even after users leave groups, so the table grows continuously.
Performance characteristics matter because this table gets hit constantly. User login processes, every assignment group query, and ACL evaluations all touch this table. ServiceNow maintains indexes on user, group, and state fields, but queries without these filters can still be expensive on large datasets.
When You'll Script Against This Table
You'll script against sys_user_grmember primarily in Business Rules for assignment logic, Script Includes for user utility functions, and UI Actions for bulk group operations. Security scripts and ACL evaluations query this table constantly, though often indirectly through gs.getUser().isMemberOf() methods that hit this table behind the scenes.
Access to this table is controlled by the user_admin role for write operations, but most users can read their own memberships. Scripts running in global scope can query freely, while scoped applications may have restricted access depending on their access controls.
Common scripting patterns:
- Check if a user belongs to a specific group before assignment or notification
- Get all active members of a group for bulk operations or reporting
- Find users who belong to multiple specific groups (intersection queries)
- Add or remove users from groups programmatically during onboarding/offboarding
- Audit group membership changes for compliance reporting
- Build custom group hierarchy navigation or membership trees
- Validate group membership before executing privileged operations
Table Gotchas
The state field is critical—always filter by state='active' when checking current memberships. Inactive records remain in the table for audit purposes, and queries without this filter return stale memberships.
- The
userandgroupfields are reference fields, but they store sys_ids as strings. Use.toString()when comparing to avoid type coercion issues.
Bulk queries without proper indexing can timeout. Always include user or group sys_id in your queries—never scan the entire table with just business logic filters.
- Creating duplicate memberships doesn't fail gracefully—the platform allows multiple active records for the same user-group combination. Use
getUserGroupMember()API instead of direct inserts.
ACL inheritance can be confusing—users gain permissions through group membership, but removing a user from a group doesn't immediately revoke active sessions or cached permissions until next login.
- The table has no built-in approval workflow for membership changes. If you need approval for sensitive group additions, implement custom Business Rules or use the User Group Membership approval process.
- Cross-scope queries can fail silently if the calling application doesn't have access to user or group tables. Always test group membership scripts across application scopes.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
The two primary related tables are sys_user and sys_user_group, which this table connects in a many-to-many relationship. You'll frequently join across all three tables to get user details alongside group information, or to find users with specific attributes who belong to certain groups. The sys_user_group_type table categorizes groups, which becomes relevant when filtering memberships by group type (ITIL vs. custom vs. approval groups).
You'll commonly join with task and its child tables when building assignment queries—checking if potential assignees belong to the right groups. The sys_user_role table works alongside group membership for comprehensive authorization queries, since users can have both direct role assignments and roles inherited through group membership.
For audit purposes, the sys_audit table tracks changes to group memberships when audit policies are enabled. Integration scenarios often involve ldap_ou_config and related LDAP tables when group memberships sync from external directory services.