How we can initiate a flow from ui action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 06:05 AM
Hi Team,
How can we initiate a flow using ui action I tried below, but it's not working.
ui action script -runs on serviceside

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 07:43 AM
A few questions/observations:
- What scope is your flow in? You didn't specify it in the startFlow line, so I'm wondering if the name might need to be global.request_approve_flow1 or something like that?
- You are sending the RITM number to your flow rather than the actual RITM variable. Is that what your flow is expecting?
- There are only 2 parameters for startFlow: flow name and inputs. You don't need the userID one.
If none of those seem to apply, maybe post some screen prints of your flow. It's hard to validate this code without seeing what it's supposed to run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 11:40 PM
1. is sys_id is fine?
2.flow expecting RITM no
3.ok will remove
can u suggest a code which will work in the above case?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 07:54 AM
You can generate a code snippet from the flow and use it.
- Go to your flow in flow designer
- Open your flow
- Click on Actions menu(three dots icon) on top right
- Select 'Create code snippet'
You can use this is your server side ui action script by adjusting accordingly.
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 12:08 AM
use this and share what came in logs
Is your flow published?
UI action and flow are in which scope?
You can use the Create Code snippet to get script on how to call it from any server side script.
// Start the flow
try {
// Set approval to 'Requested'
current.approval = 'requested';
current.update();
var ritmNumber = current.number;
gs.info("inputsvalue0" + ritmNumber);
var inputs = {
ritmNumber: ritmNumber
};
// Log the input being sent to the flow
gs.info("inputsvalue" + JSON.stringify(inputs));
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.assign_remediation_task8e3').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.request_approve_flow1').inForeground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader