i want to trigger flow through ui action

Akash Kajro
Tera Contributor

i want to trigger  flow through Ui action. when ever i click on button the flow should trigger.

I have copied the code snippet of the flow and  pasted it in ui action.

what should i mention in 

inputs['changed_fields'] = ??; // Array.Object

 

AkashKajro_0-1720010533021.png

 

 

@Ankur

@Ankur Bawiskar

 

can you please let me know

7 REPLIES 7

Yashsvi
Kilo Sage

Hi @Akash Kajro,

please check below link:

https://www.servicenow.com/community/developer-forum/how-to-trigger-a-flow-from-a-ui-action/m-p/2162...

Thank you, please make helpful if you accept the solution.

Dnyaneshwaree
Mega Sage

Hello @Akash Kajro,
The inputs['changed_fields'] in your snippet is where you pass data to the flow. For example, if your flow expects sys_id, short_description, and assigned_to as inputs, you would define it like this:

inputs['changed_fields'] = {
    sys_id: current.sys_id, // assuming 'current' is available in the UI action context
    short_description: current.short_description,
    assigned_to: current.assigned_to
};

Please accept my solution if it works for you and thumps up to mark it as helpful.

Thank you!!

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Ankur Bawiskar
Tera Patron
Tera Patron

@Akash Kajro 

yes it's possible.

what error you received when you ran above script?

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

Hi @Ankur Bawiskar  i am not to trigger the flow on the default view..But the Ui Button is not working on Hr agent workspace view