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
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¶
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: 1. Check Value 1 - if not empty, return it 2. If Value 1 empty, check Value 2 - if not empty, return it 3. If Value 2 empty, check Value 3 - if not empty, return it 4. 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)
Output Fields¶
| Field | Description | Example |
|---|---|---|
task_19001_found | Successfully found value | true/false |
task_19001_key | Which value was used | "Value 1" or "Fallback" |
task_19001_value | The selected value | (555) 123-4567 |
Real-World Examples¶
Example 1: Contact Phone Number Selection¶
Workflow: 1. Form Submission - Contact form 2. Coalesce - Get best phone number 3. Phone Formatter - Format to E.164 4. Match to Client - Find existing contact 5. SMS - Send confirmation
Get Best Phone:
Value 1: {{task_55001_mobile_phone}}
Value 2: {{task_55001_phone}}
Value 3: {{task_55001_work_phone}}
Value 4: {{task_55001_home_phone}}
Fallback: Not Provided
Format Phone:
Send SMS:
To: {{task_24001_formatted}}
Message: Thanks for your inquiry! We'll contact you at {{task_19001_value}} soon.
Why this works: - Checks mobile first (most common) - Falls through to other phone types - Won't send SMS if no phone provided (checks if value != "Not Provided")
Example 2: Multi-Source Email Priority¶
Workflow: 1. Webhook In - User data from multiple systems 2. Coalesce - Get best email 3. If Task - Validate email exists 4. Match to Client - Find existing contact 5. Email - Send welcome
Prioritize Email Sources:
Value 1: {{task_46001_verified_email}}
Value 2: {{task_46001_primary_email}}
Value 3: {{task_46001_account_email}}
Value 4: {{task_46001_billing_email}}
Value 5: {{task_46001_support_email}}
Fallback: needs-email@company.com
Priority reasoning: 1. Verified email - Highest confidence (confirmed by user) 2. Primary email - User's designated main email 3. Account email - Used for account creation 4. Billing email - Valid for payments 5. Support email - From support tickets 6. Fallback - Triggers internal flag for manual review
Validate Email:
Condition: {{task_19001_value}} != needs-email@company.com
True: Continue with email workflow
False: Add "Missing Email" tag + create task for sales team
Example 3: Company Name with Individual Fallback¶
Workflow: 1. Form Submission - Lead form 2. Coalesce - Get company name 3. If Task - Determine if B2B or B2C 4. Match to Client - Find existing client 5. Add appropriate tags
Get Company Name:
Value 1: {{task_55001_company_name}}
Value 2: {{task_55001_organization}}
Value 3: {{task_55001_business_name}}
Fallback: {{task_55001_first_name}} {{task_55001_last_name}}
Result Examples: - If form has company: "Acme Corp" - If individual: "John Smith" (from fallback using name fields)
Determine Type:
Condition: {{task_19001_key}} != Fallback
True: B2B lead (had company name) → Tag "B2B"
False: B2C lead (used name fallback) → Tag "B2C"
Why this works: - Tries multiple company field variations - Falls back to person's name if no company - Can detect which type based on key field - Ensures client record always has a name
Example 4: Address Data Consolidation¶
Workflow: 1. Webhook In - Customer data from API 2. Coalesce - Get street address 3. Coalesce - Get city 4. Coalesce - Get postal code
5. Coalesce - Get country 6. Formatter - Build complete address
Get Street Address:
Value 1: {{task_46001_shipping_address}}
Value 2: {{task_46001_billing_address}}
Value 3: {{task_46001_mailing_address}}
Value 4: {{task_46001_physical_address}}
Fallback: Address Not Provided
Get City:
Value 1: {{task_46001_shipping_city}}
Value 2: {{task_46001_billing_city}}
Value 3: {{task_46001_mailing_city}}
Fallback: Unknown City
Get Postal Code:
Value 1: {{task_46001_shipping_postal}}
Value 2: {{task_46001_billing_postal}}
Value 3: {{task_46001_mailing_postal}}
Fallback: 00000
Get Country:
Value 1: {{task_46001_shipping_country}}
Value 2: {{task_46001_billing_country}}
Value 3: {{task_46001_account_country}}
Fallback: United States
Build Complete Address:
Format: Concatenate
Components:
{{task_19001_value}} (street)
{{task_19002_value}} (city)
{{task_19003_value}} (postal)
{{task_19004_value}} (country)
Separator: ,
Result: "123 Main St, Springfield, 12345, United States"
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