Coalesce Task¶
Overview¶
The Coalesce Task returns the first non-empty value from a list of options. Use it to provide fallback values, handle missing data gracefully, and ensure your workflows always have usable values.
When to use this task:
- Provide default values for empty fields
- Handle missing form data
- Chain multiple data sources with priority
- Prevent workflow failures from null values
- Multi-source data consolidation
- Required field validation
- Fallback logic for integrations
- Data quality management
Key Features:
- Check multiple values in priority order
- Return first non-null/non-empty value
- Support for unlimited value checks
- Handles null, empty strings, and unresolved variables
- Always provide ultimate fallback
- Tracks which value was selected
Values are tested in order and the first non-empty one wins; the fallback is only reached when every option is empty:
flowchart LR
A{Value 1 empty?} -->|No| B[Use value 1]
A -->|Yes| C{Value 2 empty?}
C -->|No| D[Use value 2]
C -->|Yes| E[Use the fallback]
Quick Start¶
- Add Coalesce task
- Configure values to check (priority order)
- Set fallback default value
- Save
Simple Example:
Value 1: {{task_49001_phone}}
Value 2: {{task_49001_mobile}}
Value 3: {{task_49001_work_phone}}
Fallback: Not Provided
Result: First phone number found, or "Not Provided" if all empty
Configuration¶
Builder fields¶
The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.
| Field | Key | Type | Default | Notes |
|---|---|---|---|---|
| Fallback Value | fallback_val |
text | – | |
| Values (first non-empty wins) | coalesce_values |
dyn-rows | – |
Value Priority List¶
Add values in order from highest to lowest priority:
Value 1: {{task_49001_primary_email}}
Value 2: {{task_49001_secondary_email}}
Value 3: {{task_15001_email}}
Fallback: no-reply@company.com
How it evaluates:
- Check Value 1 - if not empty, return it
- If Value 1 empty, check Value 2 - if not empty, return it
- If Value 2 empty, check Value 3 - if not empty, return it
- If all empty, return Fallback value
Fallback Value¶
Ultimate default if all values are empty:
Important: Always provide a meaningful fallback value.
Empty Detection¶
Coalesce treats these as empty:
null(actual null value)""(empty string)- Unresolved variables starting with
{{(e.g.,{{task_99001_missing}})
Coalesce treats these as non-empty (valid values):
"0"(zero as string)0(number zero)"false"(string false)false(boolean false)- Whitespace strings like
" "(contains characters)
Outputs¶
| Field | Type | Example | Notes |
|---|---|---|---|
value |
string | jane@example.com |
The first non-empty value, or the fallback when every option was empty. |
key |
string | contact_email |
Which input supplied the value. Useful for knowing why you got what you got. |
match |
boolean | true |
true when one of the options had a value; false when the fallback was used. |
run |
boolean | true |
|
run_text |
string | Coalesce complete. |
match distinguishes a real value from the fallback
The fallback is returned in value just like a real match, so match is the only way to tell
whether any option actually had data.
Real-World Examples¶
Fall back through several ways of naming someone¶
Form Submission
└─ Coalesce full name, then first name, then "there"
└─ Email "Hi {{task_19001_value}},"
{{task_19001_key}} tells you which option supplied the value, and {{task_19001_match}} is
false when every option was empty and the fallback was used.
Pick whichever contact number was supplied¶
Use a default when a custom field is blank¶
CRM Trigger
└─ Match to Client look the client up
└─ Coalesce the client's account manager, then the team inbox
Best Practices¶
Value Ordering¶
- Most reliable first - Verified or validated data sources
- User input next - Direct form submissions from users
- System data - Calculated or derived values
- Sensible fallback - Always provide meaningful default
Example priority:
Value 1: {{task_55001_verified_phone}} ← User confirmed
Value 2: {{task_55001_entered_phone}} ← User entered
Value 3: {{task_15001_existing_phone}} ← From CRM record
Fallback: (000) 000-0000 ← Obvious placeholder
Fallback Values¶
- Descriptive - Use "Not Provided" instead of "N/A"
- Type-appropriate - Numbers:
0, Text: "Unknown", Boolean:false - Process-safe - Won't break downstream tasks
- Never truly blank - Always have ultimate fallback
Good fallbacks:
- Phone: "Not Provided" or "000-000-0000"
- Email: "no-email@company.com"
- Name: "Unknown Contact"
- Amount:
0.00
Bad fallbacks:
- Empty string
""(defeats purpose) null(may cause errors)- "TBD" (unclear what it means)
Use Cases¶
Good uses:
- Phone number selection (mobile vs. landline vs. work)
- Email address priority (multiple sources)
- Name field fallbacks (first name, full name, username)
- Address data sourcing (shipping vs. billing)
- Required field handling
- Multi-system data consolidation
Not needed for:
- Single data source (nothing to coalesce)
- Boolean fields (already true/false)
- Fields where empty is valid answer
Combining with If Task¶
Check the coalesce result:
Coalesce Task → {{task_19001_value}}
If Task → {{task_19001_value}} = "Not Provided"
True: Flag for manual follow-up
False: Continue automated workflow
Or check which source was used:
If Task → {{task_19001_key}} = "Fallback"
True: Low data quality → assign to data team
False: Good data → continue automation
Troubleshooting¶
Always Returns Fallback¶
Issue: Never using provided values, always defaults to fallback
Causes:
- All source values are actually empty/null
- Variables not resolving correctly
- Wrong variable references
Debug: Add Note task to inspect values
Note: Checking coalesce values:
Value 1: [{{task_55001_field1}}]
Value 2: [{{task_55001_field2}}]
Value 3: [{{task_55001_field3}}]
Coalesce result: [{{task_19001_value}}]
Coalesce key: [{{task_19001_key}}]
Solution: Check form field names, verify data submission
Wrong Value Selected¶
Issue: Using Value 2 when Value 1 has data
Causes:
- Value 1 contains empty string
"" - Value 1 variable doesn't exist (returns
{{...}}pattern) - Value 1 is null
Solution: Verify data source, check for null vs empty string
Whitespace Issues¶
Issue: Value with only spaces " " not treated as empty
Note: Coalesce does NOT trim whitespace - " " is considered non-empty
Solution: Use Formatter task to trim before coalesce
Zero Treated as Empty¶
Issue: Number 0 or string "0" skipped
Good news: Coalesce correctly treats 0 as valid (non-empty)
If seeing issues: Verify variable is actually 0 not empty string
Frequently Asked Questions¶
How many values can I check?¶
Unlimited. Add as many Value fields as needed.
Can I use calculated values?¶
Yes, any task output variable works.
Is order important?¶
Yes! Always check highest priority first. First non-empty value wins.
What if I don't want a fallback?¶
You must provide a fallback. Use empty indicators like "Empty" or "N/A".
Can I nest Coalesce tasks?¶
Yes, use one Coalesce output as input to another:
Coalesce 1 → Best phone: {{task_19001_value}}
Coalesce 2 → Value 1: {{task_19001_value}}, Value 2: (555) 000-0000
Does it work with numbers?¶
Yes, but 0 is a valid number (not empty). If you need to treat 0 as empty, use If Task logic instead.
Can I use it for dates?¶
Yes, works with any data type including dates.
How do I know which value was selected?¶
Check {{task_19001_key}} - returns "Value 1", "Value 2", etc., or "Fallback"
Related Tasks¶
- If Task - Check coalesced value conditions
- Formatter - Clean data before coalescing
- Variable - Store coalesced value for later use
- Merge Data - Combine multiple data sources
- Phone Formatter - Format coalesced phone numbers
- Match to Client - Use coalesced contact data