Subflow having wait for duration flow logic failing when called from script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2023 11:18 PM
Issue:
we have a subflow which having "wait for duration of time" flow logic, when we calling that subflow from serverside with code snippet it showing error in catch block like below, how to call such subflows with script having such waits... !?
Error:
com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state
Code:
try {
var result = sn_fd.FlowAPI.getRunner().subflow('global.test').inForeground().run();
var outputs = result.getOutputs();
var output = outputs['output']; // String
gs.info(output)
} catch (ex) {
gs.info('error123 '+ex);
}
wait for duration is only 15sec ...
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2023 11:57 PM - edited ‎08-24-2023 11:58 PM
Hi @saikrishna_12 ,
Please refer to the solution of this thread which should give you a clarity on why this is happening,
https://www.servicenow.com/community/developer-forum/subflow-does-not-return-outputs-to-script-inclu...
Thanks,
Sonam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2023 07:20 PM
Try setting a timeout sn_fd.FlowAPI.getRunner() .flow('global.test_flow') .inForeground() .timeout(1500) .run();