How to Trigger flow designer with virtual agent ?

Atul kumar
Tera Guru

I want to trigger a flow designer based on the conversation with virtual agent

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Flow Designer (as of pre-Madrid) is triggered in two main ways. First with a record update/insert, the other on a scheduled basis.

If you want, have VA create/update a record that triggers the flow.

In Madrid, we offer an API to start a flow or action via a script API.

FlowAPI - startFlow | ServiceNow Developers

View solution in original post

7 REPLIES 7

thanks we are just trying to follow best practice since we are about to do some automated VA conversations with external systems. 

hi chuck,

 

can you give an example script which triggers subflow or flow from the virtual agent script action?

for example I have subflow named as reset password  how can I can call that from virtual agent Script Action.

 

 

Within Flow Designer, on your Flow or Subflow, use the Code Snippets in the upper right menu.

find_real_file.png

 

From there, copy and paste the script where needed (eg. VA script). Mine looks like this:

(function() {
	
	try {
		var inputs = {};
		inputs['current'] = ; // GlideRecord of table:  
		inputs['changed_fields'] = ; // Array.Object 
		inputs['table_name'] = 'x_66238_cls323_employee';

		// Start Asynchronously: Uncomment to run in background.
		// sn_fd.FlowAPI.startFlow('x_66238_cls323.employee_trigger_test', inputs);
				
		// Execute Synchronously: Run in foreground.
		sn_fd.FlowAPI.executeFlow('x_66238_cls323.employee_trigger_test', inputs);
		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}
	
})();