Add To Response (Dynamic)

Overview

Add To Response (Dynamic) adds key-value pairs to the flow response and evaluates their values when the response is generated. This means the response uses the latest value of each referenced variable, including any changes made later in the flow.

Use this stage when response fields should reflect the final state of your flow variables.

* This example demonstrates how Add To Response (Dynamic) always returns the latest value of the variable. After counter is increased by the Fast Adder stage, the response returns currentCount = 1.

Note: The variable names, values, criteria, and configuration used in this example are for demonstration purposes only.

Configuration

Required Fields

FieldDescriptionExample
Name (Response Key)The key that will appear in the response. Enter it as plain text without variable brackets.currentCount, finalStatus, itemsProcessed
Value (Response Value)The variable reference whose latest value should be included in the response.{{counter}}, {{status}}, {{totalItems}}

Fixed vs Dynamic

AspectFixedDynamic
When the value is evaluatedWhen the stage runsWhen the response is generated
Value after later changesRemains unchangedUses the latest variable value
Best suited forValues that should be captured at a specific point in the flowValues that may continue changing before the flow completes

Example: Fixed and Dynamic Values

Flow: 1. Set Default Value: counter = 0 2. Add To Response (Fixed): count → {{counter}}   Captured value: count = 0 3. Fast Adder: counter + 1 4. Add To Response (Dynamic): currentCount → {{counter}}   Latest value: currentCount = 1 

Response: {  "count": 0,  "currentCount": 1 }

StepActionCurrent value of counterResponse value
1Set Default Value0
2Add To Response (Fixed)0count = 0 (captured)
3Fast Adder (+1)1
4Add To Response (Dynamic)1currentCount = 1 (latest)

Exit Points

ExitWhen
PassAlways. This stage does not have a fail exit.

How It Works

When executed, the stage:

  1. Receives the configured fields – Reads each response key and variable reference.
  2. Stores the variable references – Keeps the fields linked to their variables rather than capturing a snapshot.
  3. Adds the fields to the response – Includes the configured key-value pairs in the response payload.
  4. Evaluates the values when needed – Uses the latest variable values when the response is generated.

Key behavior: If a referenced variable changes after this stage runs, the response reflects its latest value.

Common Use Cases

1. Return Final Progress Values

Include variables that are updated as the flow progresses.

Configuration:

  • itemsProcessed{{totalItems}}
  • currentStatus{{status}}

Result: The response contains the latest values after the flow has completed its updates.

2. Return Branch-Specific Values

Add values that are set differently depending on the route taken through the flow.

Pass branch:

  • success{{successCount}}

Fail branch:

  • error{{errorMessage}}

Result: The response reflects the values set by the branch that was executed.

3. Combine Fixed and Dynamic Response Fields

Use Fixed for values that should be captured immediately and Dynamic for values that may change later.

Add To Response (Fixed):

  • processedAt{{timestamp}}
  • version2.0

Add To Response (Dynamic):

  • itemsProcessed{{totalItems}}
  • currentStatus{{status}}

Result: The response combines values captured at stage execution time with values evaluated when the response is generated.

Best Practices

  • Use Dynamic for variables that may change later in the flow.
  • Use clear, consistent response key names.
  • Initialize optional variables with Set Default Value to avoid empty values.
  • Combine Fixed and Dynamic stages when the response needs both captured and final values.
  • Test the complete execution path to confirm that the final response contains the expected values.

Common Mistakes

MistakeSymptomFix
Using variable brackets in the response keyThe response contains an incorrect key name Enter the key as plain text, for example userId.
Using Fixed when the value must reflect later changesThe response contains an earlier valueUse Add To Response (Dynamic).
Referencing an uninitialized variableThe response contains an empty or null valueInitialize the variable with Set Default Value earlier in the flow.
Expecting the value to remain unchangedThe response value changes after the variable is updatedUse Add To Response (Fixed) when a snapshot is required.

Troubleshooting

IssueCommon CauseFix
Field is missing from the responseThe response key or value is empty or misconfigured Check that both fields are completed and that the stage is on the executed flow path.
Value is different from the value seen when the stage ranThe variable was updated later in the flowReview later stages that modify the variable, or use Fixed if the earlier value is required.
Value is empty or nullThe variable was not initialized before the response was generatedInitialize it with Set Default Value.
Response structure is inconsistentSome variables are only created on specific branchesInitialize all expected response variables before routing the flow.

Do's and Don'ts

DoDon't
Use Dynamic for values that may change before the response is generated.Do not use variable brackets in response key names.
Use variable references such as {{userId}}.Do not expect Dynamic values to remain frozen after the stage runs.
Initialize optional variables before using them.Do not use Dynamic when you need to preserve an earlier value.
Use Fixed and Dynamic together when both behaviors are needed.Do not assume every branch creates the same variables.

Edge Cases

  • Variable not initialized: The dynamic reference may resolve to an empty or null value.
  • Variable changed after the stage: The response uses the latest value.
  • Same variable used more than once: Each reference resolves to the same latest value.
  • Null values: A null value remains null rather than being converted to text.
  • Data types: The current variable type is preserved in the response.

Related Stages