Creating SOQL Filters

SOQL filters let you refine your Salesforce data so it is cleaner and more relevant to your business processes in Geopointe. Applying SOQL filters to Map Objects or Assignment Plans can help you:

  • Prevent unqualified leads or inactive customers from geocoding
  • Filter out incomplete addresses (and save data storage)
  • Limit records to a specific state, region, account type, etc.
If you have ever created a data set filter in Geopointe, you were actually creating a SOQL filter, but with the help of a field and operator selector. We’ll show you how to make one when those selectors aren’t available.

Basics of SOQL

Even if you’re not a developer, it’s helpful to know what a SOQL query is. The query below uses SELECT, FROM, and WHERE statements to retrieve the names of Leads with ‘Qualified’ in the Status field:

SELECT Name FROM Lead WHERE LeadStatus = ’Qualified’

When you create a SOQL filter, you only need to write the WHERE clause, or the field value to filter by. Include single quotation marks around the specified value. From the above query, the SOQL filter would be:

LeadStatus = ’Qualified’

Note: If you are referencing a custom field, make sure to reference the API name of the field, ending in __c.

Multiple Conditions

You can use logical operators (AND, OR) to include multiple conditions. The SOQL filter below will process qualified leads that have over 50K in revenue:

LeadStatus = ‘Qualified’ AND AnnualRevenue > ‘50,000’

Filtering Out Incomplete Addresses

The filter below uses the OR operator to prevent records from processing if any of the indicated address fields are blank. The use of null indicates a blank field. If none of the fields are blank, then the record is geocoded.

StreetAddress=null OR City=null OR State=null OR Country=null OR Zipcode=null

When you're adding this filter to a Map Object, make sure to use the address or coordinate fields that are being mapped for that Map Object. 

Checkbox Fields

If you are referencing a Checkbox (Boolean) field, you can use values of true or false to indicate whether the field is checked. The filter below will process records with the Active field checked:

Active = true

Learn More

This is just a basic introduction to working with SOQL filters and statements, but Salesforce offers extensive documentation on SOQL syntax and how to make a WHERE clause. Here are a few resources:

Condition Expression Syntax: WHERE Clause
Trailhead: Write SOQL Queries