Quick Help: Can anyone pls tell me calling a flow designer from UI action is possible?

Prakash1to
Mega Expert

Hi,

We are trying to trigger both On boarding and detailed assessments from business service form once it is created and we provide this flexibility through a UI actions (buttons). We configured triggers and actions in flow designer.

 

But is there anyway to call a flow in UI action script?

Urgent help is required.

1 ACCEPTED SOLUTION

kushal Tayade
Mega Guru

 

Use below code in the UI action

try {
var flowInputs = {};
flowInputs['current'] = current;
flowInputs['table_name'] = current.getTableName();

var result = sn_fd.Flow.startAsync('SCOPENAME.FLOWNAME', flowInputs);
//The Sys ID of a flow execution (contextId)
var contextId = result.contextId;

} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}

View solution in original post

7 REPLIES 7

rahulpandey
Kilo Sage

HI,

Flow designer can be triggered on update of record, you can create a true/false field(hidden) and on UI action click just make current.field_name = true; current.update();

This will update the record and then make flow designer to run only if that field is true.

Thanks Rahul for your suggestion. Let me check.

Santi Cots
Tera Contributor

Hi,

Starting with NewYork release, you should be able to call a flow from UI action using the new APIs: FlowAPI or GlideFlow, depending if you want to execute on server or client side.

More here: https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/administer/flow-designer/concept/api-access-flow-designer.html

Eric Feron
Moderator
Moderator

Hello there,

Just checking if you got your question answered.

Thank you 😊

EF