sosl-patterns

Document SOSL FIND syntax, RETURNING clauses, and search groups for Salesforce objects.

2|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill sosl-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sosl-patterns
Source: https://github.com/bhanu91221/claude-sfdx-iq/tree/main/skills/sosl-patterns
Command: npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill sosl-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently designing and validating SOSL searches across Salesforce objects can be challenging due to complex syntax, data-grouping, and performance considerations. This guide consolidates common patterns, decision rules, and example queries to accelerate safe, effective search implementations.

Core Features & Use Cases

  • Detailed breakdown of FIND syntax, IN clause usage, and RETURNING field selections across multiple objects.
  • Guidance on constructing search groups, data filtering, and handling relationship and polymorphic fields.
  • Practical use cases including global object searches, knowledge article queries, and cross-object result composition for dashboards or UIs.

Quick Start

Provide a comprehensive SOSL pattern set across Account, Contact, KnowledgeArticleVersion objects.

Frequently Asked Questions about sosl-patterns

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

FAQPage Schema
How do I use SOSL to search across multiple Salesforce objects at once?

SOSL searches multiple Salesforce objects simultaneously using the FIND syntax combined with RETURNING clauses to specify field selections for objects like Account, Contact, and KnowledgeArticleVersion.

When should I use SOSL instead of SOQL for my Salesforce queries?

Use SOSL instead of SOQL when you need to execute global text searches across multiple objects simultaneously, whereas SOQL is better suited for querying a single object with precise relational filters.

How do I construct a SOSL search to find specific text in Salesforce Knowledge articles?

You construct a SOSL search for KnowledgeArticleVersion objects by using the FIND syntax to specify your search term and the IN clause to target relevant data groups, then selecting fields in the RETURNING clause.

What are the performance considerations when designing SOSL searches in Salesforce?

Performance considerations for SOSL searches involve structuring search groups properly, applying data filtering within RETURNING clauses, and handling relationship or polymorphic fields efficiently to ensure safe query execution.

Can I filter SOSL results by specific fields when searching Salesforce records?

Yes, you can filter SOSL results by specifying field selections and applying data filters directly within the RETURNING clause to narrow down records returned for each object in your search query.

What is the correct syntax for building a global search query with SOSL in Salesforce?

The correct SOSL syntax requires a FIND clause for the search term, an optional IN clause for search groups, and a RETURNING clause defining which objects and fields to retrieve in the Salesforce results.