> For the complete documentation index, see [llms.txt](https://docs.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/rule-based-configuration/trigger-conditions.md).

# Trigger Conditions

Understand filter criteria as trigger conditions and available operators.

Filter criteria determine when a rule should act. They let you target specific conditions, patterns, or characteristics without writing code—transforming broad automation into precisely focused responses.

## Understanding Criteria

Think of filter criteria as the rule's decision logic. When a record is evaluated, the criteria answer a simple question: "Does this record deserve this rule's attention?" If yes, the rule fires. If no, evaluation moves to the next rule or stops.

Criteria work exactly like filters in Salesforce reports or list views. You select a field from the record being evaluated, choose how to compare it (equal, greater than, less than), and specify what value to match against. This three-part structure—field, operator, value—forms the foundation of all filtering.

The power comes from combining multiple criteria. A single field check might be too broad: "Category equals Flow" catches all Flow errors, including trivial validation issues. Add a second condition—"AND Priority equals High"—and you're targeting only significant Flow failures. Add a third—"AND Impacted Users Count greater than 10"—and you're focusing on widespread impact.

### The Optional Nature of Criteria

Criteria are completely optional. A rule without any filter criteria evaluates to true for every record it sees—a universal catch-all that fires constantly. This behavior has legitimate uses, particularly as a final fallback rule in a routing sequence, but it should be intentional rather than accidental.

Most rules benefit from at least some filtering. Even broad rules typically narrow to one organization or exclude certain categories. The goal is finding the right balance between overly permissive criteria that create noise and overly restrictive criteria that miss important conditions.

## Available Fields

The fields you can filter on depend on what object your rule evaluates. Rules that examine logs have access to log fields—error category, exception type, user information, and technical details. Rules that examine issues work with issue fields—summary, priority, user count, and aggregate metadata.

The available field list isn't just standard Salesforce fields. Custom fields you create on these objects automatically appear in the filter criteria dropdown, working just like standard fields with operators appropriate to their data type. This extensibility means you can build organization-specific filtering around your own classification schemes.

Some contexts have timing constraints that affect field availability. When speed is critical and rules need to evaluate records the instant they're created, only immediately populated fields are available. Fields that require post-processing or calculation might not be accessible in these real-time evaluation contexts. Most rules work with the full field set, but it's worth understanding this distinction when dealing with time-sensitive automation.

Common fields you'll filter on include:

**Categorization and Type:** These fields classify what kind of error or issue you're dealing with—Apex, Flow, Integration, and so on. Type provides more granular detail about the specific exception or problem pattern.

**Impact Metrics:** User count and record count tell you the breadth of an issue's effect. These quantitative measures help you distinguish between isolated incidents and widespread problems.

**Temporal Fields:** Created date and last occurrence date let you filter based on when things happened. This supports patterns like "only alert on issues seen in the last week" or "archive logs older than six months."

**Identification and Context:** Fields like functional area, organization, and status help you understand where errors fit in your system's structure and operational state.

{% hint style="info" %}
**Field Availability**

The complete set of filterable fields depends on your Pharos configuration and any custom fields your team has created. The interface shows exactly what's available when you build filter criteria—you don't need to memorize the list.
{% endhint %}

## Operators

Operators define how your specified value compares to the field's actual value. Pharos offers one operator set across all field types:

| Operator                                | Typical use                                                          |
| --------------------------------------- | -------------------------------------------------------------------- |
| **Equal** / **Not equal**               | Exact matching on text and picklist fields — "Category equal Flow"   |
| **Greater than** / **Greater or equal** | Numeric and date thresholds — "Impacted Users Count greater than 50" |
| **Less than** / **Less or equal**       | The same, inverted — "Average Frequency less than 7"                 |
| **Contains** / **Doesn't Contain**      | Partial text matching — "Summary contains Timeout"                   |
| **Includes** / **Excludes**             | Multi-select picklist membership                                     |

For **text fields**, Contains is what makes pattern-style filtering possible: matching a fragment of an error message or a flow name prefix without knowing the whole value. For **picklists**, prefer Equal, or combine conditions with OR logic to match several values ("Priority equal High OR Priority equal Highest").

**Numeric fields** support the mathematical comparisons, which is what enables impact-based filtering — "Impacted Users Count greater than 50" focuses on widespread issues while ignoring isolated incidents.

**Date and time fields** compare against a specific date/time value, for example "Created Date greater than \[a fixed date]." There isn't a set of relative date keywords (like "LAST\_WEEK") built into the operator itself; date thresholds are specified explicitly.

Criteria always compare a field against a value you specify. Comparing one field to another isn't part of filter criteria — the places where records are evaluated relative to each other are update rules, which look at a field's old and new values, and the field grouping used by monitoring rules described below.

## Combining Criteria with Logic

Multiple filter conditions combine using familiar boolean logic. By default, all conditions must be true—an implicit AND between each criterion. This default works well for most rules: you want Flow errors AND High priority AND recent occurrences.

Custom filter logic gives you more sophisticated control when needed. You might want errors that are either Flow OR Apex, but definitely in Production. Express this as "(1 OR 2) AND 3" where the numbers reference your filter conditions. Parentheses group operations just like mathematical expressions, and AND/OR connect conditions in intuitive ways.

The syntax is straightforward—number your conditions, use AND and OR keywords, and add parentheses for grouping. The system validates your logic and shows you what will match. Most rules need only simple logic, but complex routing scenarios sometimes benefit from sophisticated conditions like "(1 AND 2) OR (3 AND 4)" to handle multiple distinct matching patterns.

### When Simplicity Beats Complexity

Before building intricate filter logic, consider whether multiple simpler rules might serve better. A rule with logic like "((1 OR 2) AND 3) OR (4 AND (5 OR 6))" might technically work, but it's hard to understand and maintain. Often, splitting this into two or three focused rules creates clearer automation that's easier for team members to grasp.

The exception is when evaluation order matters and you need to prevent multiple rules from firing. In sequential evaluation contexts, consolidating related logic into one rule with complex criteria may be preferable to managing the order of multiple simpler rules.

## Advanced Filtering: Field Grouping

Beyond standard filter criteria, some rule contexts support **field grouping**—a specialized filtering concept that compares records to each other rather than to specific values.

While filter criteria asks "does this record match my specifications?", field grouping asks "do these records match each other?" It ensures that all records triggering the rule share the same value for a designated field.

Consider a threshold-based rule monitoring for volume patterns. Without grouping, the rule fires when any combination of records meets the threshold—10 Flow errors plus 10 Apex errors triggers a "20 logs" threshold. With grouping on the Category field, those 10 Flow and 10 Apex errors are treated separately. The rule only fires if a single category reaches the threshold—20 Flow errors or 20 Apex errors, but not a mix.

This grouping capability is particularly powerful when combined with fingerprinting or identification fields. Grouping on the finest-grain fingerprint essentially monitors for a single specific issue recurring rapidly. Grouping on category or functional area detects when a particular type of problem concentrates, even if it spans multiple specific issues.

Field grouping works alongside regular filter criteria. You might filter to "Functional Area equals Integration" to focus only on integration errors, then group by external system or type to detect spikes within specific integration domains. The filter narrows what you're examining; the grouping ensures the examined records match each other.

{% hint style="warning" %}
**Context-Specific Feature**

Field grouping appears in rule types designed to detect patterns across multiple records. Not all rule types support this feature—it's available where comparing records to each other makes logical sense for the rule's purpose.
{% endhint %}

## Filter Strategy

Effective filtering balances specificity with maintainability. Overly broad filters create noise, while overly narrow filters require constant updates as your system evolves.

Start with simpler criteria and add specificity based on observed behavior. A rule filtering only on "Category equals Flow" might generate too many notifications. Adding "AND Priority equals High" focuses on significant issues. Adding "AND Impacted Users Count greater than 5" ensures you're alerted to problems with real impact. Each refinement is informed by actual data rather than speculation about what might happen.

Custom fields deserve thoughtful value design. If you create a Functional Area field for categorization, use descriptive values that remain meaningful months later—"Order Processing" and "Integration Services" rather than "Area1" and "Area2". Future team members will thank you.

Filter criteria require maintenance as your application evolves. When you deploy new features or refactor old code, review rules filtering on affected categories or functional areas. When functionality is deprecated, remove filters targeting it. Treating rule maintenance as part of your deployment process keeps automation aligned with reality.

Testing complex filter logic helps avoid surprises. Write out in plain English what you want to match, build filters to express that intent, then verify against real data. Check both that intended matches work and that intended non-matches don't accidentally trigger the rule. This is especially important for intricate OR logic or negative conditions.

## Common Filtering Patterns

Certain filtering patterns appear repeatedly across effective rule configurations.

**Organization-based filtering** separates production from lower environments, applying different urgency levels. Errors from your production org ("Organization equal Production") might trigger immediate alerts, while errors from a sandbox generate daily summaries. This recognizes that environment context fundamentally changes error significance.

**Priority thresholding** filters for "Priority in (High, Highest)" to route only urgent issues to interrupt-driven channels like PagerDuty. Medium and low priority items still get tracked but through less disruptive channels.

**Functional area routing** uses custom categorization to direct errors to relevant teams. Integration team owns integration failures, data team handles batch processing errors, and so on. This pattern keeps specialized teams focused on their domain.

**Temporal filtering** focuses attention on recent or active problems. "Created Date greater than \[a date 7 days ago]" ignores historical issues in favor of current concerns. "Last Occurred On greater than \[yesterday's date]" catches issues still actively occurring.

**Impact-based filtering** applies thresholds to user or record counts. "Impacted Users Count greater than 10" distinguishes between isolated incidents and widespread problems, escalating only when impact warrants attention.

**Status exclusion** prevents resolved or duplicate issues from re-triggering notifications. "Status not equal Completed AND Status not equal Duplicate" keeps your focus on active, unique problems rather than already-handled situations.

## Troubleshooting Filter Behavior

When filters don't behave as expected, systematic investigation reveals the issue. Rules that never fire despite matching records often have overly restrictive criteria—try temporarily removing filters one by one to identify which prevents matching. Field values may not match exactly as expected—text fields are case-sensitive, and "Equals" requires precise matches including trailing spaces.

Rules that fire too frequently suggest criteria that are too broad. Adding more specific conditions usually solves this, though sometimes high firing frequency reveals an underlying application problem worth investigating separately. For sequential rule evaluation, check whether a broader rule above yours is catching records first.

Complex filter logic deserves special attention when behavior seems incorrect. Test simple cases first—verify that each individual condition works, then combine them incrementally. Write out your logic in plain English and confirm your filter logic expresses that intent. Parentheses grouping requires particular care—"1 OR 2 AND 3" might not mean what you think without parentheses to clarify precedence.

## Practical Examples

Seeing filter criteria in context helps build intuition for effective rule design.

A **critical production flow error rule** might filter for "Category equal Flow AND Priority equal Highest AND Organization equal Production"—three straightforward conditions that together target a specific high-urgency scenario. The filters work together to eliminate noise while ensuring truly critical situations get immediate attention.

A **team-specific routing rule** might need only a single filter: "Functional Area equals TPM". This assumes you've instrumented your error logging to tag errors with functional areas, but once that's in place, routing becomes trivial. The simplicity of this filter reflects good upstream data design.

An **impact threshold rule** combines numeric and status filtering: "Impacted Users Count greater than 20 AND Status not equal Completed". This targets widespread active problems while ignoring resolved issues, ensuring notifications focus on current concerns affecting multiple users.

An **integration errors rule** uses OR logic to group related error types: "Functional Area equal Integration OR Category equal Mulesoft". The logic recognizes that integration problems span a functional area (callout and REST errors are Apex-category logs tagged with the Integration functional area) as well as the Mulesoft category, and the filter casts a net wide enough to catch them all while excluding unrelated errors.

{% hint style="success" %}
**Learning from Production**

Your most effective filters will emerge from observing actual error patterns in your environment. Start with broad filters, monitor what matches, and refine based on that feedback. This empirical approach beats trying to predict every scenario upfront.
{% endhint %}

***

**Continue to** [**Rule Actions**](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/rule-based-configuration/rule-actions.md) to understand what happens when your filter criteria match.
