- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 09:08 AM
Is there a way to see how many flows use a subflow? Similar to the "Contained by" count on Roles or Variable Sets.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 12:05 PM
Hi @Stefan_Garcia ,
Hope you are doing great.
To determine the number of flows that use a specific subflow, we can execute a database query to fetch the relevant records. elow is an example of how you can accomplish this using a GlideAggregate query:
var subflowSysId = 'INSERT_SUBFLOW_SYS_ID_HERE'; // Replace with the sys_id of the subflow you want to check
var flowCount = 0;
var gr = new GlideAggregate('wf_subflow');
gr.addQuery('subflow', subflowSysId);
gr.addAggregate('COUNT');
gr.query();
if (gr.next()) {
flowCount = gr.getAggregate('COUNT');
}
gs.info('Number of flows using the subflow: ' + flowCount);
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 12:00 PM
Hi @Stefan_Garcia ,
You can find the above information in this table "sys_hub_sub_flow_instance". You can find both Flow and its associated SubFlow in this table.
Please mark my answer as helpful and accept it as a solution, if it helps!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2023 07:50 AM
Why is this not the accepted solution? This is so simple and definitely the easiest and best solution - thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 12:05 PM
Hi @Stefan_Garcia ,
Hope you are doing great.
To determine the number of flows that use a specific subflow, we can execute a database query to fetch the relevant records. elow is an example of how you can accomplish this using a GlideAggregate query:
var subflowSysId = 'INSERT_SUBFLOW_SYS_ID_HERE'; // Replace with the sys_id of the subflow you want to check
var flowCount = 0;
var gr = new GlideAggregate('wf_subflow');
gr.addQuery('subflow', subflowSysId);
gr.addAggregate('COUNT');
gr.query();
if (gr.next()) {
flowCount = gr.getAggregate('COUNT');
}
gs.info('Number of flows using the subflow: ' + flowCount);
Regards,
Riya Verma