Ui Action

swati swagatika
Tera Contributor

I have created one Button on incident form that is "Ask for approval". My requirement is when I will click on that button it triggers the flow designer which I have created for approval request. I mean it should ask for the approval to a specific person when I will click that button. How can I achieve that.

4 REPLIES 4

Tai Vu
Kilo Patron
Kilo Patron

Hi @swati swagatika 

You can use the API below to runs a flow from server-side script in your UI Action.

startFlow(String name, Map inputs)

Sample

 

// Map inputs. For a flow with a record trigger, inputs are the record and table
  var inputs = {};
  inputs['current'] = current; // GlideRecord of table:  
  inputs['table_name'] = 'incident';

   // Execute the global flow called test_flow 
   sn_fd.FlowAPI.executeFlow('global.test_flow', inputs);

 

 

Or you can just simply build an UI Action that upon clicking, it will update the record State to specific value "Waiting for Approval".

Then in your flow, the Trigger is set as Updated and the Condition is state matching to the above value.

 

Cheers,

Tai Vu

swati swagatika
Tera Contributor

Can I use Flow deigner flow name in the executeFlow (last line)?

Amit Gujarathi
Giga Sage
Giga Sage

HI @swati swagatika ,
I trust you are doing great.

var inputs = {};
inputs['current'] = current; // GlideRecord of the table
inputs['table_name'] = 'x_cpts_onboarding_cpts_referral_data';

// To start the flow asynchronously, uncomment the following line:
// sn_fd.FlowAPI.startFlow('x_cpts_onboarding.invite_to_apply', inputs);

// To execute the flow synchronously, use the following line:
sn_fd.FlowAPI.executeFlow('x_cpts_onboarding.invite_to_apply', inputs);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



How Can I use Flow designer in this script?

Can we add flow designer or only workflow?