Flow Designer - Search through flows efficiently with scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2025 12:31 AM
Today we will explore a method I've recently developed while looking over the Network Requests generated while a flow is loaded in Flow Designer.
After a long research through the tables that "make" a flow , I've realised there is no way you can actually find any details of the way an action is configured(eg. an "Update Record" action type).
That made me think that , somehow , Flow Designer dynamically builds the flow when we load it.But how does that happen ?
My investigation started with investigating the HTML tree to see if I can find any relevant table name where any helpful information might be stored.Nothing found.
After, I went through most of the Network Requests generated while a flow is loaded.
Well , without anymore suspense , this was it! Finally found it .
Turns out Servicenow uses this internal endpoint "https://{YOUR-INSTANCE-NAME}.service-now.com/api/now/processflow/flow/{FLOW-SYS-ID}?sysparm_transaction_scope=global" to dynamically generate the mapping between Actions and Inputs.
The response after this Network Request is done is a JSON full of informations.
For my interest , the most relevant keys inside the JSON are :
1)actionInstances ---> keeps mapping for actions like : Create Record , Update Record , Look up record etc.
actionInstances structure for a basic 3 actions Flow
Expanded object inside actionInstances
Relevant data inside an element of actionInstances : actionType -> Update Record ; inputs -> see on what table Update is against and what values are updated
2)flowLogicInstances ---> keeps mapping for logic actions like : If , For Each ,Set Flow Variable etc.
Now , what can you do with this ?
A simple use case (yet saves loads and loads of time) : We need to find out , what flow adds Additional Comments on the incident table.
With this method ? Simple as it sounds!
1)Create a script that iterates through all the flows by querying sys_hub_flow (of course you can limit the flows that you want to search based on table).
2)For each flow make a call to the newly discovered endpoint(add basic auth also) :
var request = new sn_ws.RESTMessageV2(); request.setHttpMethod('get'); request.setEndpoint('https://{YOUR-INSTANCE-NAME}.service-now.com/api/now/processflow/flow/{FLOW-SYS-ID}?sysparm_transaction_scope=global'); request.setBasicAuth('{ADMIN-USER-NAME}', '{USER-PASSWORD}'); response = request.execute(); httpResponseStatus = response.getStatusCode(); var body = response.getBody(); //ans will have the body with all the relevant data. var ans = JSON.parse(body); //I recommend you first gs.info(JSON.stringify(ans)); so you can see the structure and decide what to do after.
3)Manipulate the data as you wish and get the relevant information from it.
That's all I wanted to share 😄
Thanks for reading and I hope this will help someone and spare your time going through all flows and checking all Actions.
- Labels:
-
flow designer
-
Search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2025 12:56 PM
Some possible reasons:
1)Check the user if it's Active and not Locked out.
2)Make sure you have the right password for that user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2025 12:54 PM
Hi Valer!
Glad to meet you !
Your requirement will require some good knowledge about the response structure. I recommend you analyze a couple of flows with OOTB actions and some custom ones.
Now , for the error . May I please see how you've built your code to call that endpoint?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2025 09:58 AM
I used a local admin user that I created, and I was able to retrieve a JSON.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello,
Can you please provide the solution. We are retiring a group and want to know where it is used.
Thanks,
Chad
BTW SN needs a tool that does this OOTB.