Could Not call a Flow from BR

Lucky1
Tera Guru

Hello all,

 

I have created a flow designer with a trigger condition like, Updated and the table name selected is Business Application and Condition is: Description contains Test 123.

and later I am triggering approvals from the Actions.

 

My requirement is, when ever any business application status is changed to Retired, then it should trigger approval to Business owner and in the same time, the status should be set to it's previous value only, but not to Retired. and only once the approver approves, then the state has to be changed to Retired, or else, the state will be set to previous state only.

 

So, for this I have written a Before Update BR, condition is: Status changed to Retired. and in the advanced script: 

Lucky1_0-1755083140982.png

 

the log Inside BR Try is coming up but the next log, Flow triggered successfully is not coming up and also, when I check the executions, the flow has not been executed.

 

Please help.

 

 

Regards,

Lucky

 

7 REPLIES 7

Ok, I see your point. So you could maybe block the manual state change completely (using a UI Policy, a Client Script, or even your BR), and introduce a UI Action "Request retirement" which calls a Subflow that is doing what ever your Flow does. IMHO that could look a bit more logical to a user instead of reverting the action and then doing all the things in background.

 

But if it shall run from the BR, I would still recommend moving the logic to a Subflow which you can call like this:

 

 sn_fd.FlowAPI.getRunner().subflow('subflow_name').inBackground().withInputs(inputs).run();

 

(see also the autogenerated script snipped on the Subflow editor page)

Ankur Bawiskar
Tera Patron
Tera Patron

@Lucky1 

your syntax to trigger flow is wrong.

This is the correct syntax.

Also I believe even if the flow triggers the Condition won't match

You are setting Short description but for that record is the Description matching?

If yes then it will trigger

var inputs = {};
inputs['current'] = current; // GlideRecord of table:  
inputs['table_name'] = current.getTableName();

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

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

 

Can you please let me know, how to create inputs in flow designer based on the inputs object values shown in BR ?

 

 

Regards,

Lucky