- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2025 12:42 PM - edited 10-07-2025 12:51 PM
Hi all,
Lately we've been splitting some of our groups into smaller groups. One of the problems that we're experiencing is finding all the areas where a group was being used and updating it to the new group. For example, we have found the old group associated with ticket assignments, flows, approvals, notifications, reports, scheduled reports, configuration items, and more.
Is there any way to query all the records that a certain group is referenced in? I was thinking of using related lists on the sys_user_group table, but given that there's 8,000 of them, that's not realistic.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2025 01:10 PM - edited 10-07-2025 01:12 PM
Hi @DylanBlumenberg,
I don't think there's an easy way for this..
My suggestion is to check the [sys_update_xml] but it's table with all the records in all update sets, so perhaps it's better to access it "sys_update_xml.filter" and press enter, it will load an empty table with no records, you apply the desired condition and then you query it. But for this you will need to know the group's sys_id, so if you have multiple groups it will be still difficult...
Another thing is to search for this using SN Utils browser extension, either slashcommand "/<sys_id>" and/or "/code <sys_id>". That can also put some lights into it.
And last, to go to Update Jobs but you will need one update job per table (e.g. one for Task, one for KB, one for CMDB, etc...) which is also quite lengthy 😕
How many groups are you going to replace, just one or several?
EDIT (orange): the slashcommand /sys_id will just open the record which will not help you :))
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2025 01:08 PM
Below code to retrieve all unique records from tables that extend the task table, and for each record, I want to extract:
Record Number
Assignment Group
Approval Group
Table Name
I limit the output to 5 records only, you can update the script to include a counter and stop after 5 records are collected.
var resultList = [];
var maxResults = 5;
var resultCount = 0;
// Get all tables extending from Task
var tableGR = new GlideRecord('sys_db_object');
tableGR.addQuery('super_class.name', 'task');
tableGR.query();
while (tableGR.next() && resultCount < maxResults) {
var tableName = tableGR.getValue('name');
gs.print('Checking table: ' + tableName);
var gr = new GlideRecord(tableName);
if (!gr.isValid()) {
gs.print('Skipping invalid table: ' + tableName);
continue;
}
gr.query();
while (gr.next() && resultCount < maxResults) {
var assignmentGroup = gr.isValidField('assignment_group') ? gr.assignment_group.getDisplayValue() : '';
var approvalGroup = gr.isValidField('approval_group') ? gr.approval_group.getDisplayValue() : '';
var number = gr.getValue('number') || gr.getDisplayValue('sys_id');
// Skip if both fields are empty
if (!assignmentGroup && !approvalGroup) continue;
resultList.push({
table: tableName,
number: number,
assignment_group: assignmentGroup,
approval_group: approvalGroup
});
resultCount++;
}
}
// Output results
gs.print('Results:\n');
for (var i = 0; i < resultList.length; i++) {
var r = resultList[i];
gs.print(r.table + ' | ' + r.number + ' | Assignment: ' + r.assignment_group + ' | Approval: ' + r.approval_group);
}Output:
*** Script: Checking table: gsw_task
*** Script: Checking table: sys_report_access_request
*** Script: Checking table: orphan_ci_remediation
*** Script: Checking table: incident
*** Script: Results:
*** Script: incident | INC0000060 | Assignment: Network | Approval:
*** Script: incident | INC0000009 | Assignment: Service Desk | Approval:
*** Script: incident | INC0000010 | Assignment: Database | Approval:
*** Script: incident | INC0000011 | Assignment: Hardware | Approval:
*** Script: incident | INC0000012 | Assignment: Database | Approval:
You can customize the above script based on your need .
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2025 01:10 PM - edited 10-07-2025 01:12 PM
Hi @DylanBlumenberg,
I don't think there's an easy way for this..
My suggestion is to check the [sys_update_xml] but it's table with all the records in all update sets, so perhaps it's better to access it "sys_update_xml.filter" and press enter, it will load an empty table with no records, you apply the desired condition and then you query it. But for this you will need to know the group's sys_id, so if you have multiple groups it will be still difficult...
Another thing is to search for this using SN Utils browser extension, either slashcommand "/<sys_id>" and/or "/code <sys_id>". That can also put some lights into it.
And last, to go to Update Jobs but you will need one update job per table (e.g. one for Task, one for KB, one for CMDB, etc...) which is also quite lengthy 😕
How many groups are you going to replace, just one or several?
EDIT (orange): the slashcommand /sys_id will just open the record which will not help you :))
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 11:32 AM
Hey @GlideFather, these are great ideas! To answer your question, we are going to replace one group with multiple groups, so for example, the catalog items that get assigned to the one group would get split across multiple groups.
I suspect that checking the sys_update_xml table will be my main method, but I will keep the other two in mind. It's very useful that sys_update_xml shows if the group is used in flows. The query time on that though 💀. You're right that this is not going to be easy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2025 02:09 PM
@DylanBlumenberg another tip: when doing some updates by a script, use these two guys in it:
setWorkflow(false);
sysAutoFiels(false);- first one prevents from triggering actions (e.g. notifications) when re-assigning and it can cause undesired behaviour like recurssive triggering BRs
- second one keeps the original value in updated on and updated by
- example: group was last updated a year ago by Beth Anglin and you update it by a script then the updated on is time of that script execution and updated by is system/admin/logged in person who executes the script (depends on what it is)
- having that AutoSysFields set to false, the script does the changes bur it doesn't override these two values
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
