I want to trigger a flow from client side UI action?

Boddedi Mounik1
Kilo Explorer

Hi,

I want to trigger a flow from client side UI action. Then when I creating a flow trigger should be given. Is there any way that without giving a trigger for the flow and initiating from UI action.

9 REPLIES 9

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could call a subflow from a UI Action. The UI Action being the trigger. Would that work for you?

See for example:
https://developer.servicenow.com/dev.do#!/learn/learning-plans/orlando/servicenow_application_develo...

Here example code of what I used for one of our cases:

function() {

                var inputs = {};
                inputs['some_subflow_input'] = 'some value';
                
                var outputs = sn_fd.FlowAPI.executeSubflow('flow_name', inputs);

                action.setRedirectURL(current);

})();

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mounika,

you can use GlideAjax script in your Client Side UI Action and refer below link on how to trigger flow from script

use that code in your script include function

Trigger flow from script

Regards
Ankur

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

Hi Ankur,

I know the script to trigger a flow. But when I creating the flow it is asking for trigger when I have given trigger in that flow it is automatically triggered when a  record met the condition.But I want to trigger the flow only from UI action. In that case , what I should give as the trigger in flow

Go for a subflow instead of a flow.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn