Trying to call a common module from multiple inbound flows. The shared flow expects a parameter, but passing it via the flow context seems to hit a scope issue.
Does the Call Flow action only accept static values, or is there a way to map a dynamic variable from the parent flow into the child’s input parameters?
The docs for genesyscloud_flow in the Terraform provider are a bit light on the parameter mapping syntax, but it’s actually pretty straightforward once you stop trying to hardcode it in the JSON UI export. You don’t need to rely on flow context scope hacks. The call_flow action block supports dynamic variable references directly in the parameters object.
Here’s how I structure it in my state files. Notice the value field isn’t a static string; it points to a specific data path in the parent flow’s context.
resource "genesyscloud_flow" "my_inbound_flow" {
name = "Inbound Sales"
type = "INBOUND"
# ... other config ...
flow {
start_node = "start"
node {
id = "start"
type = "start"
entry_nodes = ["call_flow_call"]
node {
id = "call_flow_call"
type = "call_flow"
# This is the shared flow ID
flow_id = genesyscloud_flow.shared_helper.id
# Map the dynamic input
parameters = {
"customer_name" = {
"type" = "string"
# Reference the variable from the parent flow's context
"value" = "$.data.customerName"
}
}
# ... transitions ...
}
}
}
}
The key is that $.data.customerName must already exist in the parent flow’s data section before this action runs. If you’re getting a scope error, check that the variable is actually populated in the parent’s data object, not just in a local variable that’s out of scope. I’ve seen this break when people try to map a variable that hasn’t been initialized in the data block yet. It’s not a bug in the API, just a timing issue in the flow execution engine. Make sure your shared flow’s input parameter definition matches the type you’re passing, or the runtime will silently drop the value.