Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow Designer - How to find FLOWs based on the triggering table AND conditions

GavinNZ
Tera Contributor

I often need to analyse what triggers are configured and cannot find where to do this with FLOWs. For example, if I want to find all FLOWS are triggered by change_request.state I cannot see a way to do this. This is a backwards step for us that often are asked to decipher the novel, poor, and erroneous configuration on a platform. Now it seems we must manually look through hundreds of FLOWS to find the needle, instead of the simple search I run on Business Rules.

 

  1. I have found the table sys_hub_trigger_instance_v2 which has the trigger inputs that are encoded. It is not Base64 encoded, tried to decode it.
  2. I found the function in the Configuration Menu for a table that adds a column to a List Query javascript:sn_flow.AssociatedFlows.getFlows("change_request")
  3. There are some APIs available but the method sn_flow.AssociatedFlows.getFlowsWithTriggerDetails(tableName) just returns the FLOW, and thir tigger type and they do not seem to be accessible or documented
  4. There are other posts asking the same thing but none get to the detail of searching by the TABLE, Trigger, and the CONDITION. 
    1. Identify active flows running on particular table - ServiceNow Community
    2. Solved: How to find out the flow designers created or defi... - ServiceNow Community
    3. Find flows that trigger actions on a table - ServiceNow Community
 
var tableName = 'change_request';
var rawJson = sn_flow.AssociatedFlows.getFlowsWithTriggerDetails(tableName);

// Print the raw JSON string
gs.info('Raw JSON for table: ' + tableName);
gs.info(rawJson);

 

Business Rules

In Business Rules I can use the LIST and Filter by table, FilterConditions, or Condition, and you have your list. I do this regularly when I start diagnosing an issue or start on a new customer instance. https://[instance_name]].service-now.com/now/nav/ui/classic/params/target/sys_script_list.do%3Fsysparm_query%3DcollectionSTARTSWITHincident%255Efilter_conditionLIKEstate%26sysparm_first_row%3D1%26sysparm_view%3D

GavinNZ_0-1765138212572.png

 

 

 

 

0 REPLIES 0