Add To Response (Fixed)
Overview
Add To Response (Fixed) adds key-value pairs to the flow response. The value is evaluated when the stage runs and is then stored as a fixed value in the response. Any later changes to the original variable are not reflected in that response field.
Use this stage to return status information, metadata, calculated results, or a snapshot of a variable at a specific point in the flow.
* This example demonstrates how Add To Response (Fixed) captures the value of a variable when the stage executes. Although counter changes later in the flow, the response keeps the original captured value (count = 0).
Note: The variable names, values, criteria, and configuration used in this example are for demonstration purposes only.
Configuration
Required Fields
| Field | Description | Example |
|---|---|---|
| Name (Response Key) | The key that will appear in the response. Enter it as plain text without variable brackets. |
|
| Value (Response Value) | The value assigned to the response key. This can be static text, a number, a variable reference, or a formula. |
{{userId}} =({{price}}*1.1) |
Value Types
| Value Type | How It Is Handled | Example |
|---|---|---|
| Static Text | The text is added to the response exactly as entered. |
|
| Number | The numeric value is added to the response. |
|
| Variable Reference | The variable is resolved when the stage executes, and the resolved value is stored in the response. | {{userId}} {{timestamp}} |
| Formula Expression | The formula is evaluated when the stage executes, and the result is stored in the response. | =({{price}}*1.1) =({{total}}/{{count}}) |
Exit Points
| Exit | When It Is Used |
|---|---|
| Pass | The stage completes and continues to the next connected stage. |
How It Works
When the stage executes, it:
- Processes each configured key-value pair and reads the Name and Value fields.
- Resolves the value by using the entered text, variable reference, number, or formula.
- Stores the resolved result as a fixed value in the response.
- Continues through the Pass exit to the next connected stage.
Key behavior: The stage stores a snapshot of the value at the moment it runs. If the source variable changes later in the flow, the response field created by this stage keeps the earlier value.
Common Use Cases
1. Add Status and Metadata
Add standard information that should be included in the final response.
Configuration:
status→successtimestamp→ {{@timestamp}}version→1.0userId→ {{userId}}
Example response:
{ "status": "success", "timestamp": 1704067200000, "version": "1.0", "userId": "user_123" }
2. Add Calculated Values
Evaluate formulas and include their results in the response.
Configuration:
totalAmount→ {{amount}}taxAmount→ =({{amount}}*0.1)netAmount→ =({{amount}}*0.9)processed→true
Example response:
{ "totalAmount": 100, "taxAmount": 10, "netAmount": 90, "processed": true }
3. Build a Response Across Multiple Stages
Use more than one Add To Response stage to add fields at different points in the flow.
Stage 1:
result→successprocessedAt→ {{timestamp}}
Stage 2:
itemCount→ {{count}}averagePrice→ =({{total}}/{{count}})
Result: The final response contains the fields added by both stages.
4. Add Branch-Specific Response Fields
Use Route Flow first, then configure a different Add To Response stage on each branch.
Pass branch:
status→completedduration→ {{elapsed}}success→true
Fail branch:
status→failederror→ {{errorMessage}}
Key Behaviors
| Feature | Behavior |
|---|---|
| Fixed Snapshot | The resolved value is stored when the stage executes and does not update later. |
| Multiple Stages | Multiple stages can add fields to the same response. |
| Variable Resolution | {{variable}} is resolved from the flow dictionary when the stage runs. |
| Formula Support | A formula beginning with = is evaluated before its result is added. |
| Response Building | The stage adds configured fields without removing unrelated response fields. |
| Single Exit | The stage continues through the Pass exit. |
Best Practices
- ✓ Use clear and consistent response key names.
- ✓ Use plain text for Name fields and variable references only in Value fields.
- ✓ Place the stage after the values it depends on have been created or calculated.
- ✓ Use formulas when the response needs a calculated value.
- ✓ Use unique key names unless you intentionally want to replace an existing response value.
- ✓ Use Add To Response (Dynamic) when the response must reflect later changes to a variable.
- ✓ Test the final response to confirm the expected values and data types.
Common Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Using variable brackets in the Name field | The response key is not created as expected. | Enter the key as plain text, for example userId. |
| Forgetting the formula prefix | The formula is treated as text instead of being evaluated. | Add the formula prefix before the expression: =({{price}}*{{quantity}}) |
| Referencing a missing variable | The response contains an empty or unexpected value. | Create or initialize the variable before this stage runs. |
| Using the same response key more than once | A later value replaces an earlier value for that key. | Use unique key names unless replacement is intentional. |
| Expecting the value to update later | The response contains the value captured earlier in the flow. | Use Add To Response (Dynamic) when the latest variable value is required. |
Troubleshooting
| Issue | Common Cause | Fix |
|---|---|---|
| Field is missing from the response | The stage was not executed, or the Name field is empty. | Confirm that the stage is connected to the active execution path and that the Name field is completed. |
| Variable value is empty | The variable does not exist when the stage runs. | Initialize it earlier with Set Default Value or create it in a preceding stage. |
| Formula is returned as text | The formula does not begin with the required prefix. | Add = before the formula. |
| Response contains an older value | The variable changed after Add To Response (Fixed) executed. | Move the stage after the final variable update or use Add To Response (Dynamic). |
| A response value was replaced | The same response key was added again later. | Review the response key names used in all Add To Response stages. |
Do's and Don'ts
Do:
- ✓ Use this stage to capture a value at a specific point in the flow.
- ✓ Enter response keys as plain text.
- ✓ Use variable references such as {{userId}} in the Value field.
- ✓ Use formulas such as =({{total}}*0.1) for calculated results.
- ✓ Confirm that required variables exist before the stage executes.
Don't:
- ✗ Do not use variable brackets in the Name field.
- ✗ Do not forget the = prefix for formulas.
- ✗ Do not expect a fixed response value to change after the stage has executed.
- ✗ Do not reuse a response key unless replacing its previous value is intentional.
- ✗ Do not place the stage before the variables or calculations it requires.
Edge Cases
- Variable changes later: The response keeps the value captured when the stage executed.
- Duplicate response keys: A later value using the same key may replace the earlier value.
- Missing variable: The response may contain an empty or null value, depending on the available data.
- Empty static value: An empty value may still be included in the response.
- Formula error: Review the formula syntax and confirm that every referenced variable exists.
Related Stages
- Add To Response (Dynimic): Capture response values when the stage runs.
- Return True: Return a successful completion result.
- Return False: Return a false completion result.
- Change Data: Update variables before the response is generated.
- Set Default Value: Initialize optional variables before using them.