how to trigger a flow from flow designer using ui action script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
How can trigger a flow (from flow designer) ui UI Action Script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
******************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Alon Grod
https://developer.servicenow.com/dev.do#!/reference/api/zurich/server/ScriptableFlowAPI
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);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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 :
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.