Child workflow database query returns null even though data exists

  1. My goal: Use a parent workflow to run a child workflow that queries Retool Database
  2. Issue: When the child workflow is run from the parent workflow, the database query returns zero results even though the evaluated query is correct. When I use that workflow run's startTrigger data as test JSON and run the query manually, the expected data is returned.
  3. Steps I've taken to troubleshoot: I've made sure that the child workflow is deployed correctly, and I've tried adding waits and logging. Logging output looks correct but the query still returns null.
  4. Additional info: (Cloud or Self-hosted, Screenshots)

Hi @Jim_Okada,

Apologies for the issue. Just to confirm, when you have the child workflow run on its own with the startTrigger data as test JSON, simulating the data payload that the parent workflow would pass down to the child, the child runs fine.

But the issue is, the parent workflow is somehow missing the step of passing this data down to the child workflow, correct?

We may need to step through this and log things out to see where the disconnect may be :thinking:

If you use the same blocks but flatten things out so its a longer series of blocks running in the parent workflow, maybe that could work for a short term fix while we figure out what step between the parent-to-child step is not working as intended.

Hey Jack, sorry for the late response. Yes, when the workflow runs on its own using startTrigger the data is processed fine.
I actually did step away from a child workflow and instead am running everything in one workflow, so for the time being it works out okay, but would like to break it down into child workflows. So will get back to you if the issue persists. (It could very well be that I'm doing something wrong!)

Hi @Jim_Okada!

No worries at all. Glad it was working as a single workflow.

I fully understand the desire to break down long flows to better modularize things.

I had another use with a similar issue where the workflow would run manually but had blocks failing automatically, and it seemed to be that the data payload was too large :thinking: and the block was hitting an out of memory issue.

I am curious as to why would would return null and not some type of error message :face_with_monocle:

We could try console logging out the incoming params from the parent workflow just to make sure the SQL search in findStakeholder is getting what it needs to return the correct results.

Hi @Jim_Okada,

How are you returning the data out of the child workflow? Are you using a response block or a JS block with a return statement? I recommend using a response block to return the data up from the child workflow to the parent!

using a JS block with return, but will try using response block instead. thanks!

edit: is there a specific reason why the response block is preferred here?

1 Like

Ahh yes that could be the reason for the data missing. I was doing some testing with JS blocks being the final step for child workflows and was seeing some issues getting the data returned.

The reason behind the difference is how the code is being executed and moved from level to level or from workflow to response output.

A return in a JS block is fairly low level, it will decide what that block is returning but not necessarily what the WORKFLOW has as the final piece of data that is being bubbled up and out of that workflow to the greater context of where that workflow was executed(inside another flow or on a server as a stand alone).

However, the Response Block is specifically designed to be the data which will be exiting a workflow, in response to either the trigger running a stand alone workflow or responding to the top level parent workflow that is triggering the child workflow!

Hi @Jim_Okada,

Just wanted to check in to see if you were still experiencing this issue. Were you able to get the sub workflow to return what you wanted using a response block?

Haven’t had a chance to deep dive, but I haven’t come across this case again atm. Thanks for following up!

1 Like