Query Builder is the underlying visual editor for filters and conditions used by Custom Query Views and many other places (reports, dashboards, workflow conditions). Learning it once means it's reusable everywhere.
Building Blocks
- Conditions: Field + operator + value, e.g.
status = open. - Groups: Brackets containing one or more conditions combined with AND or OR.
- Nesting: Groups inside groups for complex logic.
- Variables: Special values like current_user, today, this_quarter.
- Field references: Use one field's value as the comparison value (e.g.
start_date < end_date).
Typical Patterns
- “A AND B”: Two conditions in one group, AND.
- “A OR B”: Two conditions in one group, OR.
- “A AND (B OR C)”: Top-level group with AND; an inner group containing B OR C.
- “NOT (A AND B)”: A group with the NOT modifier on the outside.
Worked Examples
- Recent VIP orders: customer.tier = enterprise AND total > 5000 AND created_at within last 7 days.
- Marketing audience: opted_in = true AND (industry = SaaS OR industry = FinTech) AND last_email_opened within last 30 days.
- Stale handoffs: status = handed_off AND last_activity < today - 14 AND owner.is_active = true.
- Date range check: start_date ≤ today AND end_date ≥ today — i.e. currently in range.
- Negation: NOT (status = closed OR status = cancelled) — i.e. still open in any sense.