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

Subflow Error retrieving outputs

NikethK
Tera Contributor

Has anyone encountered an issue where Subflow A calls Subflow B, but an error occurs when retrieving the outputs?

 

In my case, Subflow A triggers Subflow B, which contains a custom API action to generate a link. The execution in Subflow B runs successfully and produces the expected output. However, when Subflow A attempts to retrieve these outputs, it returns an error.

1 ACCEPTED SOLUTION

G Ponsekar
Giga Guru

Hi @NikethK ,

 

The error typically happens due to a mismatch in data types or structure between what Subflow B defines as its output and how Subflow A attempts to consume it. 
Here are the most likely causes for this behavior and steps to resolve it.
 
1. Data pill structure and complex objects
The most frequent cause of this error is a mismatch in how complex data is defined and handled. If your custom API action generates a complex JSON object (for example, with nested values), and the Subflow output is defined as a simple string, the data will be corrupted. 
Solution:
  • Create a custom object template: For complex outputs, define a custom Complex Object in the Flow Designer. This provides a structured schema for the data.
  • Update the custom API action: Modify the action to use this complex object template for its output.
  • Update Subflow B outputs: Make sure the output in Subflow B is also defined as the same complex object.
  • Update Subflow A: When you try to access the output in Subflow A, the data pill will now have a structured path (Subflow B -> Output -> my_nested_field), making it easy to reference correctly. 
 
2. Output assignment in Subflow B
There is a specific Flow Designer logic block for assigning output variables. If you use a generic Set Flow Variable action instead of the dedicated one, the output may not be passed to the calling flow correctly. 
Solution:
  • Use the correct flow logic: Ensure that at the end of Subflow B, you are using the Assign Subflow Outputs flow logic.
  • Check the output value: Verify that the data pill for the custom API action's output is correctly mapped to the Subflow B output variable within the Assign Subflow Outputs action.
 
3. Asynchronous execution and timing
In some cases, Flow Designer might attempt to retrieve the output before Subflow B has fully finished processing it, especially with long-running custom actions. This could leave the output variable empty. 
Solution:
  • Verify successful completion: While your logs indicate Subflow B succeeded, it's worth double-checking that the action completing the output runs to the very end before the subflow terminates.
  • Add a delay (for diagnostics only): As a temporary troubleshooting step, you can add a Wait for a duration of time action in Subflow B just before the Assign Subflow Outputs step. This is a crude method but can help diagnose if a timing issue is the problem

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

 

View solution in original post

5 REPLIES 5

Nilesh Pol
Tera Guru
Tera Guru

@NikethK Ensure the output variables in Subflow B are correctly defined as "Output" variables and have the appropriate data type,

verify custom API output, is it returning Object? then simply returns the value instead of JSON.stringify(), 

use gs.info(), in your custom Api to verify the output in logs,

You can share your code here for further investigations.

G Ponsekar
Giga Guru

Hi @NikethK ,

 

The error typically happens due to a mismatch in data types or structure between what Subflow B defines as its output and how Subflow A attempts to consume it. 
Here are the most likely causes for this behavior and steps to resolve it.
 
1. Data pill structure and complex objects
The most frequent cause of this error is a mismatch in how complex data is defined and handled. If your custom API action generates a complex JSON object (for example, with nested values), and the Subflow output is defined as a simple string, the data will be corrupted. 
Solution:
  • Create a custom object template: For complex outputs, define a custom Complex Object in the Flow Designer. This provides a structured schema for the data.
  • Update the custom API action: Modify the action to use this complex object template for its output.
  • Update Subflow B outputs: Make sure the output in Subflow B is also defined as the same complex object.
  • Update Subflow A: When you try to access the output in Subflow A, the data pill will now have a structured path (Subflow B -> Output -> my_nested_field), making it easy to reference correctly. 
 
2. Output assignment in Subflow B
There is a specific Flow Designer logic block for assigning output variables. If you use a generic Set Flow Variable action instead of the dedicated one, the output may not be passed to the calling flow correctly. 
Solution:
  • Use the correct flow logic: Ensure that at the end of Subflow B, you are using the Assign Subflow Outputs flow logic.
  • Check the output value: Verify that the data pill for the custom API action's output is correctly mapped to the Subflow B output variable within the Assign Subflow Outputs action.
 
3. Asynchronous execution and timing
In some cases, Flow Designer might attempt to retrieve the output before Subflow B has fully finished processing it, especially with long-running custom actions. This could leave the output variable empty. 
Solution:
  • Verify successful completion: While your logs indicate Subflow B succeeded, it's worth double-checking that the action completing the output runs to the very end before the subflow terminates.
  • Add a delay (for diagnostics only): As a temporary troubleshooting step, you can add a Wait for a duration of time action in Subflow B just before the Assign Subflow Outputs step. This is a crude method but can help diagnose if a timing issue is the problem

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

 

Thanks, your first suggestion worked.


After updating Subflow B to return the entire object rather than just the extracted string, and then iterating through that object in Subflow A to retrieve the string, the flow executed without any errors.

Why does the data corrupt if i am able to extract the string from the nested object and then try to return only that string to my output which is also a string type?

The idea was that my action will return an object , Subflow B will iterate through the object to get the link but with this solution it would still fail if i wrap it in Subflow A which calls Subflow B to just get the link.