- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 10:05 PM
Hi team,
Can someone please help me on how to trigger a flow from another flow.
I have an existing flow as "XYZ". I have created new flow "ABC" and in the new flow i have a trigger condition and an Action. I have stored the script below in the action, so when the trigger condition is met the action invokes and in turn triggers the flow "XYZ".
Please help me on what should be passed as the input parameter in this case or what change must be done in order for it to trigger. I have taken 'Catalogtask' as input parameter for the flow action and tried it passing as an Object, String & Reference, it gives me an error "*** Script: Invalid GlideRecord input format found"
(function() {
try {
var inputs = {};
inputs['current'] = 'Catalogtask'; // GlideRecord of table:
inputs['table_name'] = 'sc_task';
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.xyz').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.xyz').inForeground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 11:37 PM
Hi,
I'm not sure what you mean when you wrote you have tried to pass a reference as input, according to your script, a reference to a GlideRecord object is expected.
Try doing something like the following
(function() {
try {
var sctaskGR = new GlideRecord('sc_task');
if (sctaskGR.get('sys_id_of_a_specific_sc_task_record')){
var inputs = {};
inputs['current'] = sctaskGR; // GlideRecord of table:
inputs['table_name'] = 'sc_task';
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.xyz').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.xyz').inForeground().withInputs(inputs).run();
}
else{
gs.warn('Not a valid record of SCTASK');
}
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 11:37 PM
Hi,
I'm not sure what you mean when you wrote you have tried to pass a reference as input, according to your script, a reference to a GlideRecord object is expected.
Try doing something like the following
(function() {
try {
var sctaskGR = new GlideRecord('sc_task');
if (sctaskGR.get('sys_id_of_a_specific_sc_task_record')){
var inputs = {};
inputs['current'] = sctaskGR; // GlideRecord of table:
inputs['table_name'] = 'sc_task';
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.xyz').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.xyz').inForeground().withInputs(inputs).run();
}
else{
gs.warn('Not a valid record of SCTASK');
}
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();