# How to use advanced filters in Salesforce

If you export Salesforce Objects, including standard and custom ones, you can filter records by field values. To do that, use SOQL. Coupler.io adds your filter value to the request as-is, so the filter must use valid SOQL `WHERE` clause syntax.

See the general syntax in the Salesforce [documentation](https://developer.salesforce.com/docs/atlas.en-us.234.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_conditionexpression.htm).

Use only `WHERE` clause conditions in the **Advanced Filter** field. Do not use other SOQL operators there, such as `ORDER BY`, `LIMIT`, or `OFFSET`.

### Common examples

#### Filter Accounts by name starting with `Test`

```sql
Name LIKE 'Test%'
```

#### Filter closed Opportunities by close date

```sql
IsClosed = TRUE AND CloseDate > 2021-03-21
```

#### Filter Opportunities by date fields with date literals

See the Salesforce [date literals documentation](https://developer.salesforce.com/docs/atlas.en-us.234.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm) for more options.

```sql
CreatedDate = LAST_N_DAYS:180 AND CloseDate = THIS_MONTH
```

#### Filter Opportunities by stage and type

```sql
(StageName != 'Closed Won' AND StageName != 'Prospecting') AND (Type = 'New customer' OR Type = 'Existing customer - upgrade')
```

<figure><img src="https://1055512216-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOFxU2LUkJMCfvbE2re5C%2Fuploads%2FpjkIRwBCKoowY1xIKEeu%2Fimage.png?alt=media&#x26;token=4537ddc1-65b0-471f-b112-ec41e17f6c72" alt=""><figcaption></figcaption></figure>
