sf-knowledge-soql-sosl

Answer SOQL and SOSL syntax questions using curated knowledge topics.

1|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/Avinava/sf-documentation-knowledge --skill sf-knowledge-soql-sosl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-knowledge-soql-sosl
Source: https://github.com/Avinava/sf-documentation-knowledge/tree/main/skills/soql-sosl
Command: npx skills add https://github.com/Avinava/sf-documentation-knowledge --skill sf-knowledge-soql-sosl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This knowledge unit provides curated, reliable guidance for using Salesforce SOQL and SOSL to query and search data efficiently, reducing reliance on scattered web sources.

Core Features & Use Cases

  • Structured Reference: Access organized topics for common SOQL and SOSL patterns, syntax, and best practices.
  • Practical Examples: See concrete query examples and API references applicable to Apex and integration scenarios.
  • Use Case: When building a Salesforce integration, consult the SOQL/SOSL topics to craft efficient queries and understand restrictions.

Quick Start

Read the topic files under knowledge/current/soql-sosl to find detailed SOQL and SOSL guidance.

Frequently Asked Questions about sf-knowledge-soql-sosl

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a SOQL query to access related records in Salesforce?

Salesforce SOQL queries access related records using relationship queries with subqueries or dot notation. You can structure efficient data access by applying specific syntax patterns and best practices to retrieve parent-to-child or child-to-parent data.

What is the difference between SOQL and SOSL for Salesforce data access?

SOQL retrieves records from specific objects using structured queries, while SOSL searches text across multiple objects simultaneously. Use SOQL for targeted data retrieval and SOSL for broad text searches across your Salesforce org.

Can I use SOQL and SOSL queries inside Apex code?

You can use both SOQL and SOSL directly within Apex code by embedding queries inline using square brackets or dynamic query strings. Following syntax best practices ensures your code handles data access efficiently and avoids governor limits.

What are the best practices for optimizing SOQL queries in Salesforce integrations?

Optimizing SOQL queries for Salesforce integrations involves using selective filters, limiting result sets, and avoiding inefficient joins. Consulting structured reference patterns helps craft efficient queries that respect API restrictions and system limits.

Why does my SOQL query fail when trying to query too many records?

SOQL queries fail when exceeding Salesforce governor limits on retrieved rows. You must apply query restrictions and pagination techniques to structure your data access efficiently and stay within platform boundaries.

Do I need SOSL to search across multiple Salesforce objects at once?

You need SOSL to search text across multiple Salesforce objects simultaneously, as SOQL only queries one object at a time. Using the correct search language ensures efficient data retrieval based on your specific use case.