Feature flags let you change workflow behavior -- enable a new code path, toggle a notification, switch between API versions -- without editing the workflow ...
Feature flags let you change workflow behavior -- enable a new code path, toggle a notification, switch between API versions -- without editing the workflow itself. Store flags in a Google Sheet or database table and read them at the start of your workflow. This decouples deployment from configuration.
Real-world example: A workflow processes orders differently based on feature flags stored in a Google Sheet. The operations team can toggle flags without touching n8n.
Google Sheet structure ("Feature Flags" sheet):
| Flag Name | Value | Description | Updated By | Updated At |
|---|---|---|---|---|
enable_new_shipping |
true |
Use new shipping rate API | ops-lead | 2025-03-10 |
email_notifications |
true |
Send order confirmation emails | marketing | 2025-03-08 |
max_retry_attempts |
5 |
Max retries for payment API | eng-lead | 2025-03-01 |
maintenance_mode |
false |
Reject all new orders | ops-lead | 2025-02-28 |
ab_test_checkout |
B |
Checkout flow variant A or B | product | 2025-03-12 |
Read flags at workflow start:
[Trigger] → [Google Sheets: Read "Feature Flags"] → [Code: Parse Flags] → [Rest of Workflow]
```text
Code node to parse flags into a usable object:
```javascript
const flagRows = $input.all();
const flags = {};
for (const row of flagRows) {
const name = row.json['Flag Name'];
let value = row.json['Value'];
// Type coercion
if (value === 'true') value = true;
else if (value === 'false') value = false;
else if (!isNaN(value) && value !== '') value = Number(value);
flags[name] = value;
}
return [{ json: { flags } }];
```text
Use flags in downstream IF nodes:
```text
// IF node: Check maintenance mode
{{ $('Parse Flags').first().json.flags.maintenance_mode === true }}
→ true: Respond with "System under maintenance" and exit
→ false: Continue processing
// IF node: Choose shipping API
{{ $('Parse Flags').first().json.flags.enable_new_shipping === true }}
→ true: Use new shipping rate API
→ false: Use legacy shipping rate API
// Expression in Retry settings
Max retries: {{ $('Parse Flags').first().json.flags.max_retry_attempts }}
```text
> **Tip: Cache Flags for Performance**
>
> If your workflow runs frequently (e.g., per webhook), reading a Google Sheet on every execution adds latency. Use a scheduled workflow that reads flags every 5 minutes and writes them to an n8n static data store or a fast key-value store like Redis.
Feature flags give non-technical team members a safe control panel for workflow behavior without risking accidental workflow edits.
**Related:** [Always Set an Error Workflow on Every Production Workflow](../error-handling-and-reliability/01-always-set-an-error-workflow-on-every-production-workflow.md) | [Use "Pin Data" to Freeze Node Output](../testing-and-debugging/01-use-pin-data-to-freeze-node-output.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.