- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 03:13 AM
Hi Team,
I need to call subflow or flow from client script? Is there any way ??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 06:27 AM - edited 08-22-2025 06:27 AM
Take a look at this.
FlowAPI
You won't be able to call this directly from a client script, but you could create a Script Include, build out your use case in it, then call it via glideAjax in your client script to run the FlowAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 06:45 AM
you can use GlideAjax and then from Script Include function invoke the flow/subflow
what did you try so far and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 07:11 AM
Hi @vidishaagarwal5 ,
You cannot call a Flow or Subflow directly from a client script because Flows and Subflows run on the server (Flow Designer), and client scripts execute on the browser (client-side).
You need to follow steps Client Script calls GlideAjax -> GlideAjax calls Script Include -> Script Include (server-side) triggers Flow/Subflow, by record action or Flow API.
You can call flow in you script like
var flowAPI = new sn_fd.FlowAPI();
flowAPI.startFlow('sys_id_of_flow', current, inputs);
Check out the below link to check more on flows.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 07:54 AM
Hi @vidishaagarwal5 ,
ServiceNow has provided "FlowAPI" class to call Flow/Subflow/Actions by using scriping. However, this can only be called from Server side scriping. So, when we want it to be called from Client side, we can use GlideAjax to invoke server side script which will trigger Flow/Subflow/Actions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 06:27 AM - edited 08-22-2025 06:27 AM
Take a look at this.
FlowAPI
You won't be able to call this directly from a client script, but you could create a Script Include, build out your use case in it, then call it via glideAjax in your client script to run the FlowAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 06:45 AM
you can use GlideAjax and then from Script Include function invoke the flow/subflow
what did you try so far and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 07:11 AM
Hi @vidishaagarwal5 ,
You cannot call a Flow or Subflow directly from a client script because Flows and Subflows run on the server (Flow Designer), and client scripts execute on the browser (client-side).
You need to follow steps Client Script calls GlideAjax -> GlideAjax calls Script Include -> Script Include (server-side) triggers Flow/Subflow, by record action or Flow API.
You can call flow in you script like
var flowAPI = new sn_fd.FlowAPI();
flowAPI.startFlow('sys_id_of_flow', current, inputs);
Check out the below link to check more on flows.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 07:54 AM
Hi @vidishaagarwal5 ,
ServiceNow has provided "FlowAPI" class to call Flow/Subflow/Actions by using scriping. However, this can only be called from Server side scriping. So, when we want it to be called from Client side, we can use GlideAjax to invoke server side script which will trigger Flow/Subflow/Actions.