Posts

Showing posts with the label Location

Location-Based SOQL Queries in Salesforce

In Salesforce, location-based SOQL queries allow you to retrieve records based on their geographic location. This feature is particularly useful for applications that require proximity-based searches or location-aware functionality. Location-based SOQL queries leverage the Salesforce Object Query Language (SOQL) along with the geolocation fields available in custom objects or standard objects like Account, Contact, and Lead. Location-Based SOQL Query Considerations Location-based queries are supported in SOQL in Apex and in the SOAP and REST APIs. Keep in mind these considerations. DISTANCE and GEOLOCATION are supported in WHERE and ORDER BY clauses in SOQL, but not in GROUP BY. DISTANCE is supported in SELECT clauses. DISTANCE supports only the logical operators > and <, returning values within (<) or beyond (>) a specified radius. When using the GEOLOCATION function in SOQL queries, the geolocation field must precede the latitude and longitude coordinates. For example, D...