Subflow triggers multiple times from UI Action on Service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 10:39 AM
Hello Community,
I have a UI Action with settings in the screenshot.
The only purpose of the UI Action is to trigger Subflow with inputs from a record. This seems to work perfectly fine on backend, however in Service portal, for some reason the Subflow triggers several times. And it is not even consistent how many times. Most of the time it is three times, but I have seen anything from twice all the way to 6 times.
Am I doing something wrong? is there a way to limit the amount of times the Subflow triggers in portal or at least somehow restrict it from the Flow designer side?
Below is the script I the UI action is running:
(function() {
var taskGR = new GlideRecord('sc_task');
taskGR.get(current.sys_id);
var deviceGR = new GlideRecord('alm_hardware');
deviceGR.get(current.variables.asset);
var inputs = {};
inputs['task'] = taskGR;
inputs['device'] = deviceGR;
var result = sn_fd.FlowAPI.getRunner().subflow('global.name_of_the_flow').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();
})();
As a sidenote, I have noticed, that when I trigger the UI action from backend, the Calling source in the Subflow shows as "UI Action: name of the action" while when triggered from Service portal, the Calling source for each Subflow execution is "Background script". I am guessing that is normal, but I am still mentioning it just in case it isn't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 11:40 PM
@Ankur Bawiskar
I am sure. I always click only once and wait for Servicenow to do its thing.
Regards
Jakub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 11:53 PM
are you able to replicate it for few of the records from where UI action is clicked or it's happening for all records when clicked?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 12:19 AM
@Ankur Bawiskar
So far I have seen it occur on all records that I have tested with.
Regards,
Jakub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 12:30 AM
raise a HI case
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader