Flow is getting failed to give output when executed via script .the flow has some for loop to check
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago
Hi all,
I’m trying to call a subflow from a Script Include (triggered via GlideAjax from a Catalog Client Script) and return the output to populate a select box dynamically on a catalog item whle submiting.
Current flow:
- User selects a subnet on the Service Portal catalog item
- onChange Client Script calls Script Include via GlideAjax
- Script Include calls subflow using:
sn_fd.FlowAPI.getRunner()
.subflow('global.subnet_ranges')
.inForeground()
.withInputs(inputs)
.timeout(300000)
.run();- Then tries to get outputs:
var outputs = result.getOutputs();
var subnet_ranges = outputs.subnet_ranges;Problem:
I get the error:
The current execution is in the waiting stateIf I increase timeout, I instead hit:
An execution timed out with timeout of 30000 MILLISECONDSObservation:
The subflow includes steps like:
- Launch Job Template (Ansible)
- Possibly waits for completion / external processing and pass outpus
So it does not complete immediately.
What I’m trying to achieve:
- Fetch subnet ranges dynamically based on selected subnet field on portal of a catalog item
- get the outputs from subflow and add them as option and Populate a dropdown field (
subnet_ranges) on the catalog item before submission
Questions:
- Is it expected thatinForegeround() fails if the subflow contains wait/async steps?
- Is there any supported way to synchronously return outputs from such a subflow?
- If not, what is the recommended pattern for this use case (catalog client script → dynamic dropdown)?
- Is using inBackground()+ storing results in a custom table + polling via GlideAjax the correct approach?
Would appreciate guidance or best practices for this pattern.
Thanks!
0 REPLIES 0
