How to trigger flow after record producer is submitted

mballinger
Mega Guru

Hello,

I have a record producer that once submitted, needs to trigger a flow designer flow. Is this possible? If so, how can I do that?

Thanks!

1 ACCEPTED SOLUTION

Jimmie Odelius
Giga Guru

Hi mballinger

Record producers in ServiceNow work by simply inserting a record into a table.
If you use catalog items you can specify a flow that should run from that requested item.

However if you still want to trigger a flow from a record producer, either match a flow condition with the created record or you can generate it from script. Full description here.

// 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);

I've never used it in a record producer script. You might need to put it in a BR that triggers on insert but in that case setting a condition on the flow itself is probably easier.

View solution in original post

8 REPLIES 8

Jimmie Odelius
Giga Guru

Hi mballinger

Record producers in ServiceNow work by simply inserting a record into a table.
If you use catalog items you can specify a flow that should run from that requested item.

However if you still want to trigger a flow from a record producer, either match a flow condition with the created record or you can generate it from script. Full description here.

// 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);

I've never used it in a record producer script. You might need to put it in a BR that triggers on insert but in that case setting a condition on the flow itself is probably easier.

Thanks for this! I read another post that said it is not possible to trigger Flows from RPs which led to my post.

Shao
ServiceNow Employee
ServiceNow Employee

In flow designer, select trigger as "Record Created" and choose your table. When a record producer is triggered it creates a record in the table and the flow triggers as per normal.

IvanC1
Tera Contributor

Hello @Shao , your hint helped me on a recent implementation! thks!

Just wanted to add that I added 'Get Variables (from the Record Producer)' action , so I could add some logic to insert some records on other tables.