How to Trigger a Flow Designer Action using Business Rule

shaik_irfan
Tera Guru

Hi,

 

I have an OOB Flow Designer called Add Comment of Scope ITSM Spoke when i open and click on Test and pass the Ticket number and Comments it is updating. Now i want to called this Action from a Business Rule for that i used below snippet but i am getting : Invalid GlideRecord input format found

 

(function executeRule(current, previous /*null when async*/) {
try {
		var inputs = {};
		inputs['ah_task'] = 'PRB0040025' ; // String 
		inputs['ah_comment'] = 'Test Comment'; // Password (2 Way Encrypted) 
		
              var outputs = sn_fd.FlowAPI.executeAction('sn_itsm_spoke.add_comment', inputs);
	        // Get Outputs:
		// Note: outputs can only be retrieved when executing synchronously.
		var output = outputs['output']; // Password (2 Way Encrypted)
gs.info(output +"Flow Designer Action");
		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
		gs.info(message + "Flow Designer Action Not working");
	}	
	
	// Add your code here

})(current, previous);

 

Can anyone please help me on this

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shaik,

Can you check below link?

https://developer.servicenow.com/blog.do?p=/post/new-in-london-new-ways-to-trigger-flows/

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

I already gone through this Ankur 😞

Dubz
Mega Sage

The FlowAPI methods are intended for use in the code snippet action in the flow designer, you can't use them in business rules. You can use Flow methods, as documented at the link below, to trigger a flow from a server side script but you can't just trigger actions this way.

https://developer.servicenow.com/app.do#!/api_doc?v=london&id=FlowScoped-startAsync_S_GR