Subflow triggers multiple times from UI Action on Service portal

JakubUs
Tera Contributor

Hello Community,

 

I have a UI Action with settings in the screenshot.

JakubUs_0-1738866451031.png

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.

13 REPLIES 13

@Ankur Bawiskar 
I am sure. I always click only once and wait for Servicenow to do its thing.
Regards

Jakub

@JakubUs 

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?

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

@Ankur Bawiskar 
So far I have seen it occur on all records that I have tested with.

Regards,
Jakub

@JakubUs 

raise a HI case

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