Skip to main content

#SOQL13 personnes en discutent

#Salesforce Developer #SOQL #Sosl

 

What are the key differences between SOQL and SOSL, and how would you use them to retrieve filtered Account records versus searching across Accounts and Contacts in a real-time Salesforce application?

1 réponse
  1. 17 oct., 17:29

    Hi @Rakesh Goud The main difference is that SOQL is used to retrieve specific records, while SOSL is used to search for text across multiple objects.

    1. SOQL (Salesforce Object Query Language)

    • Used to retrieve records based on specific conditions.
    • Supports WHERE, ORDER BY, and LIMIT.
    • Supports querying related objects.
    • Example: Retrieve Accounts where Industry is Banking.

    SELECT Id, Name, Industry

    FROM Account

    WHERE Industry = 'Banking'

    2. SOSL (Salesforce Object Search Language)

    • Used to search for text across multiple objects.
    • Searches searchable fields using Salesforce search indexes.
    • Useful when you don't know which object contains the information.
    • Example: Search for "John" in Accounts and Contacts.

    FIND 'John*' IN ALL FIELDS

    RETURNING Account(Id, Name),

    Contact(Id, Name, Email)

    When to use each?

    • SOQL: Reports, filtered Account lists, related records, and specific data retrieval.
    • SOSL: Global search, customer lookup, and searching across Accounts, Contacts, and other objects.

    Real-time Example:

    In an LWC application, use SOQL to display Accounts filtered by Industry. Use SOSL when a user enters a customer name in a search box and you want to search both Accounts and Contacts.

    Useful Salesforce Documentation:

    My suggestion: Use SOQL when you know what records you need, and SOSL when you need to search for information across multiple objects.

    Hope this helps!

0/9000

#Trailhead Challenges #Apex #SOQL If an Apex class needs to retrieve thousands of records, how would you write efficient SOQL queries and avoid hitting Salesforce governor limits? 

2 réponses
  1. 13 oct., 04:50

    Hi @Rohith thammali When working with thousands of records in Apex, writing efficient SOQL queries is very important to avoid governor limits.

    A few best practices I follow:

    1. Avoid SOQL inside loops. Query records once and process them using collections.
    2. Fetch only required fields. Avoid unnecessary fields and records.
    3. Use WHERE conditions to filter records efficiently, preferably using indexed fields.
    4. Use Maps and Sets to handle bulk records and avoid repeated queries.
    5. Use Batch Apex when processing large data volumes.
    6. Use LIMIT carefully. It's useful when you need only a specific number of records, not when you must process everything.

    Also, remember that synchronous Apex generally allows 100 SOQL queries and 50,000 queried rows per transaction.

    Focus on bulkification, selective queries, and proper collection usage. These make a big difference in real-time projects.

    Hope this helps!

0/9000

Hi, this query works in SOQL but I am hoping to do create a report type.  I am not having much luck.  Any idea if I can create a report type to handle these objects? 

 

SELECT 

LinkedEntity.Name, 

ContentDocument.Title, 

ContentDocument.LatestPublishedVersion.TextPreview 

FROM ContentDocumentLink 

WHERE LinkedEntity.Type = 'Contact'  

 

These report types show no data: "File and Content Report" and "Content Report" 

 

 

Thanks, Aron! 

 

#Reporting  #SOQL  #Notes & Attachments

4 réponses
  1. 7 oct., 22:12

    Unfortunately Reporting on Notes is a Dead End, that's one of the many reasons why a lot of orgs don't use them, and remove the Notes & Attachments related list from Parent Object Page Layouts

0/9000

#SOQL #Salesforce Admin

 

What level of SOQL knowledge is generally expected from a Salesforce fresher during interviews? Should I focus more on relationships, aggregate queries, or basic queries?

1 réponse
  1. 8 oct., 09:26

    Hi @Vadde Chandu Reddy

     

    For a Salesforce fresher, I would suggest focusing on basic SOQL first and then moving to relationship and aggregate queries. 

     

    Here are the important topics to prepare:

    1. Basic SOQL: SELECT, FROM, WHERE, ORDER BY, LIMIT.
    2. Filtering: AND, OR, IN, NOT IN, LIKE, NULL.
    3. Relationship Queries: Parent-to-Child and Child-to-Parent queries.
    4. Aggregate Queries: COUNT(), SUM(), AVG(), MIN(), MAX(), GROUP BY.
    5. Date Filters: TODAY, YESTERDAY, LAST_N_DAYS.
    6. SOQL in Apex: Querying records, using bind variables, and understanding governor limits.

    A few real-time interview scenarios to practice:

    • Get the top 5 Opportunities by Amount.
    • Fetch Contacts related to a specific Account.
    • Find Accounts without Contacts.
    • Count Opportunities grouped by Stage.
    • Get Opportunities created in the last 30 days.

    My suggestion:

     Spend 50% of your preparation on basic queries, 30% on relationship queries, and 20% on aggregate queries. 

     

    For freshers, interviewers generally focus more on your understanding of SOQL and your ability to write queries for real-world scenarios. 

     

    Don't just memorize syntax. Practice writing queries in the Developer Console or Salesforce Inspector.

    Hope this helps! 

     

    Thank you, 

    Venkat Yadav. 

0/9000
4 réponses
  1. 3 sept., 11:06

    @Hitesh Sharma for learning SOQL from scratch, follow this order:

    Basics → SELECT/FROM → WHERE → AND/OR/IN → ORDER BY → LIMIT → LIKE → NULL → Relationship Queries → Aggregate Functions → GROUP BY/HAVING → SOQL in Apex → Bind Variables.

    The official SOQL for Admins Trailhead module covers these topics with hands-on practice. SOQL for Admins – Trailhead 

0/9000
5 réponses
  1. 3 sept., 11:09

    @Hitesh Sharma  

    Apex Basics → Variables/Conditions/Loops → List/Set/Map → sObjects → SOQL/SOSL → DML → Classes/Methods → Constructors → Triggers → Governor Limits & Bulkification → Test Classes → Async Apex → Integrations.

    Practice every topic with small programs in Developer Console/VS Code.

    Start with Salesforce's Apex Basics & Database module, then move to Apex Triggers and Apex Testing. Apex Basics & Database – Trailhead Apex Developer Guide 

0/9000

I need to know the Stages and order of those Stages for a particular Sales Process. I can get all Stages and their order from the OpportunityStage object, but that gives me all stages, not just those specific to a particular process. 

 

And I can find out what Sales Process is associated with my Opp by looking up the Record Type and pulling the BusinessProcessID. But I can't figure out how to determine what Stages are relevant to which Sales Process via flow. 

 

Is there anyway to get to that information with lookups? 

 

#Flow  #SOQL

10 réponses
0/9000

In Apex, how do I declare a CSV file, access it, pass its data to a method that inserts the contents in the database, and then close it?

 

Thanks!

 

#Apex #SOQL #Csv To Records

7 réponses
  1. 22 juil. 2025, 17:40

    I ran into something similar a while back when working with large CSV files and Salesforce. Sometimes native import tools just aren’t flexible enough, especially if you need scheduled or automated uploads. You can check out Skyvia and some information about it on this page. They’ve got a few options for importing and exporting data between Salesforce and CSV files, and you don’t have to deal with any complex setup.

0/9000

Native Integration with Data Cloud: Salesforce Developers Ask Me Anything November 2024

 

Join host @Alba Rivas and product experts @Amrinder Chadha, @Diana Jaffe and @Minhaj Khan for an in-depth discussion on integrating @* Data 360 * with the Salesforce Platform for agents.

 

Discover how to unlock the full potential of Data Cloud using familiar platform features including fields, related lists, flows, and advanced data objects (DMOs & DLOs) through #SOQL and #SQL in #Apex.

 

Bring your technical questions and get ready to explore how #Agentforce can help streamline and enhance your agent workflows.

 

Click here to register now.

 

*All AMAs are recorded and can be watched on demand on our YouTube channel.

Native Integration with Data Cloud: Salesforce Developers Ask Me Anything November 2024 Join host and product experts , and for an in-depth discussion on integrating with the Salesforce Platform for a

#Flow #Einstein Search #Enrichment Tools #Fields & Relationships #DMO

0/9000

#SOQL Queries #Salesforce Admin #SOQL

 

SOQL QUERY: Query all flows in your Org. (Use Tooling API)

 

Select Id,DefinitionId,MasterLabel, ManageableState, VersionNumber, Status, Description, ProcessType, CreatedDate,CreatedById, TriggerOrder, RunInMode, ApiVersion, Environments, TimeZoneSidKey,  ProgressStatus from flow where Status = 'Active'

6 commentaires
  1. 14 oct. 2024, 09:18

    You can also identify schedule-triggered flows with the query:

     

    SELECT id, IsActive, Label, ProcessType, ManageableState , TriggerObjectOrEventId, TriggerObjectOrEventLabel, TriggerType FROM FlowDefinitionView WHERE triggertype = 'Scheduled'
0/9000