how to trigger a flow from flow designer using ui action script

Alon Grod
Tera Expert

Hi,

How can trigger a flow (from flow designer) ui UI Action Script ?

4 REPLIES 4

Dr Atul G- LNG
Tera Patron

https://www.servicenow.com/community/developer-forum/how-to-trigger-a-flow-from-a-ui-action/m-p/2162...

https://servicenow-events-or-lab-guidebo.gitbook.io/knowledge-2026/knowledge-2026/ccl7230-k26/exerci...

https://www.servicenow.com/community/service-management-forum/i-want-to-execute-the-flow-of-the-flow...

 

var flowInputs = {};
flowInputs['current'] = current;
flowInputs['table_name'] = current.getTableName();

var result = sn_fd.Flow.startAsync('flow name', flowInputs);
****************************************************************************************
Regards
Dr Atul G. - Learn N Grow Together ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
******************************************************************************************

Tanushree Maiti
Tera Patron

Hi @Alon Grod 

 

Refer: https://developer.servicenow.com/dev.do#!/learn/learning-plans/australia/servicenow_application_deve...

 

https://developer.servicenow.com/dev.do#!/reference/api/zurich/server/ScriptableFlowAPI

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/flow-triggered-from-another-flows-...

 

  var inputs = {};
        inputs['table_name'] = '<your_Table_Name>';
        inputs['current'] = current; // GlideRecord of table: incident
       sn_fd.FlowAPI.startFlow('global.[internal name of flow]', inputs);
        // Execute Synchronously: Run in foreground.
        sn_fd.FlowAPI.executeFlow('global.[internal name of flow]', inputs);

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@Alon Grod 

the information you are looking for is easily available in docs or developer site

what did you try and where are you stuck?

Docs link below

FlowAPI - Scoped, Global 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

yashkamde
Giga Sage

Hello @Alon Grod ,

 

To trigger a Flow using script, you must use a server-side script utilizing the built-in sn_fd.FlowAPI or sn_fd.Flow...

 

so rather than writing a script manually generate itself from your code :

Screenshot 2026-07-26 212833.png

 

Script will something like this :

(function() {
	
	try {
		var inputs = {
                   'current': current, 
                   'table_name': current.getTableName()
                };

		// Start Asynchronously: Uncomment to run in background.
		// sn_fd.FlowAPI.getRunner().flow('global.<flowname>').inBackground().withInputs(inputs).run();
				
		// Execute Synchronously: Run in foreground.
		sn_fd.FlowAPI.getRunner().flow('global.<flowname>').inForeground().withInputs(inputs).run();
		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}
	
})();

 

Then Use that block of code in your UI Action Script..

 

If my response helped mark as helpful and accept the solution.