How to Trigger a Flow Designer Action using Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2019 06:23 AM
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
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2019 07:33 AM
Hey David,
It is working now but the Output i am getting as undefined do you know why ?
Actually output should be JSON Object since i am doing a Rest Call.
In the Flow Designer Execution i can see the output in the Response Body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2019 07:45 AM
I assume you're triggering a flow now that contains the add_comment action? The output of the action is fed back in to the flow but you would need something in your flow to package it up and return is as part of the REST response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2019 09:38 PM
Hi shaik.irfan,
Please refer below code in server side script to trigger your flow form your script:
var flowInputs = {};
flowInputs['current'] = current;
flowInputs['table_name'] = current.getTableName();
var result = sn_fd.Flow.startAsync('global.alternate_approval', flowInputs); //here alternate_approval is my flow designer action name
//The Sys ID of a flow execution (contextId)
var contextId = result.contextId;
Also reffer below link for more information for triggering flow designer from server side script: https://developer.servicenow.com/app.do/app.do#!/lp/servicenow_application_developer/app_store_learn...
Please mark as correct/helpful if my solution helps you to solve your query..!!
Regards,
Meghnath