The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Flow Designer Help !!

vidishaagarwal5
Tera Contributor

Hi Team,

 

I need to call subflow or flow from client script? Is there any way ??

4 ACCEPTED SOLUTIONS

Zach Koch
Giga Sage
Giga Sage

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

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@vidishaagarwal5 

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?

FlowAPI 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Bhimashankar H
Mega Sage

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.

FlowAPI - Scoped, Global 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

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.

RaviGaurav_0-1755874469006.png

 

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

8 REPLIES 8

Zach Koch
Giga Sage
Giga Sage

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

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

@vidishaagarwal5 

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?

FlowAPI 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bhimashankar H
Mega Sage

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.

FlowAPI - Scoped, Global 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Ravi Gaurav
Giga Sage
Giga Sage

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.

RaviGaurav_0-1755874469006.png

 

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/