How to Get a List of All Flow Designer and Workflow Editor Where a Specific Assignment Group is Used

cmitchell2323
Tera Contributor

Hello, I am currently working on a project for my company that involves needing to find a list of all Flow Designer and Workflow Editor flows where a specific assignment group from the [sys_user_group] table is utilized within an action/activity. Is there a specific way to query these results?

 

Ex: Suppose there is a group called "Software Engineering". I want to find a list of Flow Designer flows where the "Create Catalog Task" action has an "Assignment group" set to "Software Engineering". I also want to find a list of Workflow Editor flows where the "Catalog Task" action has an "Assignment group" set to "Software Engineering".

 

Please let me know if I can provide any further clarification. Thanks!

4 REPLIES 4

swapnali ombale
Kilo Sage

Hi @cmitchell2323 ,

 

Yes we can search where is that Group used in Workflow , can't comment on flow as of now please find the steps for searching it in flow.

 

1. Navigate to sys_variable_value Table

2. Copy Syd id of the Group you are trying to search in Workflow activities

3. Paste it in Value Column.

 

You will able to see all the workflow activities where the group is used.

 

Please mark correct if it helps.

Tami Lewis1
Tera Contributor

Thank you! Very helpful.
Just to confirm, you don't have a solution for doing the same for flows in Flow Designer?

Hi @Tami Lewis1 

To find all Flow Designer flows using a specific assignment group, you can use a background script to query the sys_flow_context and sc_task tables, filtering by the assignment group's sys\_id and mapping the flow context to the task, then printing the results. 
 
Here's a more detailed breakdown:
 
1. Identify the Assignment Group's Sys ID:
  • Determine the sys\_id of the specific assignment group you are interested in. 
     
2. Script to Query Flows and Actions:
  • Use a background script to query the sys_flow table to fetch all flows. 
     
  • For each flow, fetch associated actions from the flow_designer_action table. 
     
  • Iterate through the actions and check if the action's inputs or definitions contain the assignment group's sys\_id. 
     
  • Use glide records of sys_flow_context and sc_task tables to map values of flow context and assignment group and print the results. 
     
Example Script Outline (Conceptual):
 
JavaScript
 
// Assuming you have the assignment group's sys_id in a variable called 'assignmentGroupId'
var assignmentGroupId = 'your_assignment_group_sys_id';

// Query all flows
var flowRec = new GlideRecord('sys_flow');
flowRec.query();

while (flowRec.hasNext()) {
var flow = flowRec.next();

// Query actions for this flow
var actionRec = new GlideRecord('flow_designer_action');
actionRec.addQuery('flow', flow.getUniqueValue()); // Use flow.getUniqueValue() to get the flow's sys_id
actionRec.query();

while (actionRec.hasNext()) {
var action = actionRec.next();

// Check if the action's inputs or definitions contain the assignment group's sys_id
// This part will depend on how the assignment group is used in the flow action
// You might need to examine the action's 'inputs' or 'definition' fields
// Example:
if (action.inputs.contains(assignmentGroupId) || action.definition.contains(assignmentGroupId)) {
// Found a flow and action using the assignment group
gs.log('Flow: ' + flow.name + ', Action: ' + action.name);
}
}
}
3. Alternative Approach using sys_flow_context and sc_task:
  • Query sys_flow_context for records related to the specific assignment group.
  • Filter by the assignment group's sys\_id in the assignment_group field.
  • Use the flow\_context's sys_id to find the corresponding task record in the sc_task table.
  • Print the flow name and task details. 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Geraldina Valer
Tera Contributor

Hello! , 

We need a script that, using an assignment group, returns all the flows where it is used. 

We queried the sys_hub_flow_component , sys_hub_action_instance_v2 , sys_variable_value tables, but were unable to obtain that data. The table flow_designer_action does not exist

Is this possible?