The CreatorCon Call for Content is officially open! Get started here.

Amarjeet Pal
Kilo Sage
Kilo Sage

 

I'm excited to share with you one of the most powerful features of flow and subflows. When working on long scripts, it can be overwhelming to write so many lines of code. That's why I've discovered a better solution - we can call a flow or subflow into any server-side or client-side script by using the 'create code snippet' option found on the right-hand side of the flow. This feature helps streamline your workflows, reduce manual errors, and improve overall efficiency in your organization. 

Example of code :

(function() {
 
try {
var inputs = {};
inputs['catalog_item'] = ; // GlideRecord of table: 
 
// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
// sn_fd.FlowAPI.getRunner().subflow('subflow_name').inBackground().withInputs(inputs).run();
 
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().subflow('subflow_name').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();
 
// Current subflow has no outputs defined.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
 
})();
 
Thanks,
Amarjeet Pal
4 Comments