מתי להשתמש
"If/then/else", "Branching", "Routers", "Switches", "Conditions", "Logic ב-workflow".
הוראות עבודה
1. Building Blocks
A. If/Then/Else
- 1 condition.
- 2 branches.
- Most common.
B. Switch / Router
- 1 condition.
- N branches.
- "If A do X, if B do Y, if C do Z, else do default".
C. AND / OR Operators
- Combine conditions.
- "If country = 'IL' AND value > $10K".
D. Loops
- Iterate over array.
- "For each lead in CSV, do X".
2. Tool-Specific
Zapier
- Filter — exit if condition false.
- Paths — branching (Pro+ only).
- Looping — limited (use Code or external).
Make.com
- Router — visual branches.
- Filter on connection — per-route conditions.
- Iterator — loops.
- Aggregator — combine after loop.
n8n
- IF node — branching.
- Switch node — multi-branch.
- Loop nodes.
- Code node — full JS/Python logic.
3. Common Patterns
A. Lead Triage
If lead.country = 'Israel' AND lead.value > 10000:
→ Notify Israel VP
→ Assign top SDR
ElseIf lead.country = 'Israel':
→ Israel SDR pool (round robin)
ElseIf lead.country in ['US', 'CA']:
→ US team
Else:
→ International generic
B. Deal Stage Movements
If deal.amount > $50K:
→ Approval workflow → Manager
ElseIf deal.amount > $10K:
→ Notify Sales VP
Else:
→ Standard pipeline
C. Customer Health Score
If health_score < 30:
→ Critical: Notify CSM immediately
→ Add to "At-risk" list
ElseIf health_score < 60:
→ Warning: Schedule check-in call
ElseIf health_score >= 90:
→ Healthy: Add to upsell campaign
4. Complex Business Rules
Use Cases
- Pricing tiers.
- Discount eligibility.
- SLA assignments.
- Permission checks.
Approach
- Map rules in spreadsheet (decision table).
- Implement as nested IF or Switch.
- Document the logic prominently.
5. Decision Tables
| Country | Industry | Size | → | Routing |
|---------|----------|------|---|---------|
| IL | SaaS | >100 | → | IL Enterprise SDR |
| IL | SaaS | <100 | → | IL SMB SDR |
| US | Any | >500 | → | US Enterprise |
| US | Any | <500 | → | US SMB |
| Other | Any | Any | → | International |
6. Loops Best Practices
Concept
- Iterator splits array → process each → Aggregator combines.
Make Example
Trigger: Watch Airtable rows
Iterator: Split by row
Loop body: For each row → Create CRM contact
Aggregator: Collect IDs
Action: Slack summary "Created 25 contacts"
Pitfalls
- Operations spike — 100 items × 5 ops each = 500 ops.
- Rate limits — destination API may throttle.
- Solution: Batch + delays.
7. Nested Conditions
Avoid Deep Nesting
- More than 3 levels = unmaintainable.
- Refactor to: Switch + Decision Table + Sub-flows.
Bad
If A:
If B:
If C:
If D:
Do X
Better
Switch on (A, B, C, D combo):
Case "AABB" → Do X
Case "AABA" → Do Y
Default → Do Z
8. Handle Edge Cases
Always include
- Null / Missing — what if field empty?
- Default branch — if no condition matches.
- Error path — if calculation fails.
9. Testing
- Run with sample data for each branch.
- Edge cases: empty, null, max values.
- Document what should happen for each scenario.
10. אסיים בהמלצה.
קלט נדרש
| פריט | תיאור |
|---|---|
| Tool | Zapier/Make/n8n/HubSpot |
| Logic | rules in plain language |
| Edge cases | known unknowns |
פלט צפוי
| רכיב | תיאור |
|---|---|
| Decision table | structured |
| Branch design | switch / nested |
| Edge case handling | null, defaults |
| Test scenarios | רשימה |
| המלצה | פעולה אחת |
דגלים אדומים
- 🚨 Deep nesting (4+ levels) — unmaintainable.
- 🚨 No default branch — silent skips.
- 🚨 No null handling — crashes.
- ⚠️ Logic in code without docs — bus factor 1.
הערות חשובות
- Decision tables > nested IFs for complex.
- Test all branches before going live.
- Document logic in workflow notes.
פרומפט לדוגמה
5-tier lead routing logic. Build it.
Customer health score automation. Switch on score ranges.
Nested IF in Zapier כבד מדי. Refactor.
© 2026 Automation Expert Pro | גרסה 1.0.0