How to identify Service Catalog items linked to specific approver groups?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Community,
I need help identifying the list of Service Catalog items that are associated with the following approver groups:
FSD-FCIT_SM-APR
FSD-FCIT_SO-APR
This is an information-only requirement. I am not looking to modify any workflows or approvals, just to understand where these groups are currently used as approvers (via catalog item approvals, workflows, flows, or approval rules).
Could you please suggest the best approach or tables to check to extract this information accurately?
If possible please provide Screenshots for better understanding .
Thanks in advance for your guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
no direct way to check in flow, but I used this approach in below link and it worked till some extent
Flow Designer - Search through flows efficiently with scripts
to search in workflow check this
Finding references / sys_ids in Workflows
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
@Ankur Bawiskar I think this is not related to my query -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
you want to which catalog items are using either of those groups for approvals?
If that's your question then the links I shared should help you
If not then what's your query?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
33m ago
Hello @nameisnani ,
Please once check below code :
var flowsWithGroupApprovals = [];
// Step 1: Get all flows with group approvals
var gr = new GlideRecord('sys_hub_flow');
gr.query();
while (gr.next()) {
var labelCache = gr.getValue('label_cache');
if (labelCache && labelCache.indexOf('sys_user_group') > -1 &&
labelCache.indexOf('approval_conditions') > -1) {
try {
var labelCacheObj = JSON.parse(labelCache);
var groupSysId = '';
var groupLabel = '';
for (var i = 0; i < labelCacheObj.length; i++) {
var item = labelCacheObj[i];
if (item.reference == 'sys_user_group') {
groupSysId = item.name.replace(/{{static\.|}}'/g, '');
groupLabel = item.label;
}
}
if (groupSysId) {
flowsWithGroupApprovals.push({
flowId: gr.sys_id.toString(),
flowName: gr.name.toString(),
groupId: groupSysId,
groupLabel: groupLabel
});
}
} catch (e) {}
}
}
// Step 2: For each flow, check if it has catalog items linked
var groupsWithCatalogItems = {};
for (var j = 0; j < flowsWithGroupApprovals.length; j++) {
var flow = flowsWithGroupApprovals[j];
// Find catalog items directly linked to this flow
var catGr = new GlideRecord('sc_cat_item');
catGr.addQuery('flow_designer_flow', flow.flowId);
catGr.query();
// Only process if catalog items exist
if (catGr.hasNext()) {
// Initialize group entry if not exists
if (!groupsWithCatalogItems[flow.groupId]) {
// Get group name
var grpRec = new GlideRecord('sys_user_group');
var groupName = '';
if (grpRec.get(flow.groupId)) {
groupName = grpRec.name.toString();
}
groupsWithCatalogItems[flow.groupId] = {
groupId: flow.groupId,
groupName: groupName,
groupLabel: flow.groupLabel,
flows: [],
catalogItems: []
};
}
// Add flow info
groupsWithCatalogItems[flow.groupId].flows.push({
name: flow.flowName,
id: flow.flowId
});
// Add catalog items
while (catGr.next()) {
groupsWithCatalogItems[flow.groupId].catalogItems.push({
name: catGr.name.toString(),
number: catGr.number.toString(),
sysId: catGr.sys_id.toString()
});
}
}
}
// Step 3: Display results - ONLY groups with catalog items
gs.print('========================================');
gs.print('GROUPS WITH CATALOG ITEM APPROVALS');
gs.print('========================================');
var groupCount = 0;
for (var groupId in groupsWithCatalogItems) {
var group = groupsWithCatalogItems[groupId];
groupCount++;
gs.print('\n[' + groupCount + '] Group: ' + group.groupName);
gs.print(' Group Sys_ID: ' + group.groupId);
gs.print(' Group Label: ' + group.groupLabel);
gs.print(' Associated Flows:');
for (var f = 0; f < group.flows.length; f++) {
gs.print(' - ' + group.flows[f].name);
}
gs.print(' Catalog Items:');
for (var c = 0; c < group.catalogItems.length; c++) {
gs.print(' - ' + group.catalogItems[c].name +
' (' + group.catalogItems[c].number + ')');
}
gs.print(' ---');
}
gs.print('\n========================================');
gs.print('Total groups with catalog items: ' + groupCount);
gs.print('========================================');
This code will extract all groups which are linked with any catalog items.
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
