Salesforce Developer Tutorial - The Complete Guide to SOQL and SOSL in 2022!

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2024
  • In this episode we go over absolutely everything about SOQL and SOSL from beginner concepts to advanced concepts! So stick with me and I promise by the end you'll know all you need to know to write great SOQL queries as a developer on the Salesforce Platform!
    GitHub Repo: github.com/Coding-With-The-Fo...
    Query Plan Tool Documentation: help.salesforce.com/s/article...
    Query and Search Optimization Cheat Sheet: resources.docs.salesforce.com/...
    Please consider donating to help continue to improve the content produced for Coding With The Force: www.paypal.com/donate?busines...
    Get Coding With The Force Merch Here: my-store-d20559.creator-sprin...
    Follow all of our social media here:
    Patreon: / codingwiththeforce
    Github: github.com/Coding-With-The-Force
    Facebook: / codingwiththeforce
    Twitter: / coding_force
    Instagram: / codingwiththeforce
    Salesforce development books I recommend:
    Advanced Apex Programming: amzn.to/3lXi8to
    Salesforce Lightning Platform Enterprise Architecture: amzn.to/2R0D4BQ
    Mastering Salesforce DevOps: amzn.to/3lTtTRN
    Apex Design Patterns Book: amzn.to/3DwqljP
    Good Non-SF Specific Development Books:
    Clean Code: amzn.to/35PuMDU
    Clean Architecture: amzn.to/35FYo6A
    Design Patterns: Elements of Reusable Object-Oriented Software Book: amzn.to/3LhvHBd
    -----------------------------------------------------------------------------------------------------------------------
    Table of Contents:
    0:00:00 - Intro
    0:02:24 - Why do we use SOQL and SOSL?
    0:03:50 - Is SOQL or SOSL the same as SQL?
    0:04:52 - How to write a basic SOQL Query (The SELECT and FROM Clauses)
    0:08:48 - How to find Object and Field API Names for your Queries
    0:13:12 - How to Filter your SOQL Queries (WHERE Clause)
    0:14:10 - Why care about Filtering a Query?
    0:18:24 - Writing a Filtered SOQL Query (WHERE Clause)
    0:21:25 - Logical Operators in SOQL
    0:28:36 - Comparison Operators in SOQL
    0:31:48 - The LIKE Comparison Operator
    0:36:46 - The IN and NOT IN Comparison Operators
    0:38:25 - The INCLUDES and EXCLUDES Comparison Operators
    0:40:41 - Encrypted Field Issues in SOQL Queries
    0:42:00 - The ORDER BY Clause
    0:47:26 - The LIMIT Clause
    0:49:31 - The OFFSET Clause
    0:52:24 - Querying for Related Record Data (Lookup and Master Detail Fields)
    0:53:20 - What are Lookup and Master Detail Relationship Fields?
    0:55:38 - How to Query for Parent Record Data on a Standard Field (relationship fields)
    1:00:00 - How to Query for Parent Record Data on a Custom Field (relationship fields)
    1:03:50 - How to Query for Child Record Data (Inner Queries)
    1:07:59 - How to use the Schema Builder to figure out Object Relationships
    1:10:34 - The WITH SECURITY_ENFORCED SOQL Clause
    1:11:58 - The USING SCOPE SOQL Clause
    1:13:49 - The FOR VIEW, FOR REFERENCE and FOR UPDATE Clauses
    1:17:50 - The FIELDS() Function in SOQL
    1:20:16 - Aggregate Functions, the GROUP BY Clause and the HAVING Clause
    1:29:29 - How to use SOQL in Apex
    1:39:24 - How to use Bind Variables in SOQL
    1:44:39 - How to use Dynamic SOQL in Apex
    1:50:10 - Benchmarking SOQL Execution Times (Limits and Execution Overview)
    1:59:42 - How and why to use the Query Plan Tool
    2:09:50 - Big Object SOQL and Async SOQL
    2:15:58 - What is SOSL?
    2:19:21 - Building a basic SOSL Query (FIND , IN and RETURNING Clauses)
    2:24:44 - The IN Clause
    2:28:20 - RETURNING Clause and Object specific Query's
    2:32:12 - The FIND Clause
    2:40:44 - The toLabel() function, the USING Listview Clause. and the SPELL_CORRECTION Clause
    2:43:20 - Using SOSL in Apex
    2:49:45 - How to use Dynamic SOSL
    2:52:47 - Protecting against SOQL and SOSL Injection
    2:57:03 - Outro
    DISCLAIMER: The views and ideas expressed on this TH-cam channel and blog are based on past development experiences and may not always work for your particular scenarios. The advice in these videos may also become outdated as technology advances. They should be used as examples for educational purposes only. Using any shown solutions in your own org is not advisable since they are example scenarios.
    #salesforce #salesforcedeveloper #salesforceadmin

ความคิดเห็น • 16

  • @neilhohmann10
    @neilhohmann10 ปีที่แล้ว +2

    Great video! Just a quick comment in reference to something you said at 45:35 in the video. In fact, the ORDER BY clause _will_ order the records by a field that is _not_ selected. For instance, the following SOQL query will organize the returned rows by last name even though LastName is not part of the SELECT clause: *SELECT Id, Name FROM Contact ORDER BY LastName*

  • @hiovanycubillosgomez5901
    @hiovanycubillosgomez5901 ปีที่แล้ว

    Cool video, thank you for explaining the difference between SAQL and SOQL.

  • @starman9000
    @starman9000 5 หลายเดือนก่อน +1

    Excellent content, i loved it. Thank you! please do cover more on LWC stuff!

  • @m.sali-art5060
    @m.sali-art5060 ปีที่แล้ว

    Thank you this is helpful !

  • @Hiturion
    @Hiturion 6 หลายเดือนก่อน

    Great content. Would love to learn more about the Async queries :).

  • @KendellWyattMMA
    @KendellWyattMMA ปีที่แล้ว

    Thanks for providing this! Incredibly helpful content. Also, you kind of sound like Michael J Fox in Back to the Future.

  • @manninggrinnan621
    @manninggrinnan621 ปีที่แล้ว +1

    Thanks, it's impressive that you can maintain for so long. I had to digest it in three sessions!

    • @CodingWithTheForce
      @CodingWithTheForce  ปีที่แล้ว +5

      Lol, well I write it all out ahead of time (the outline of the video, not the exact words I say) and then I actually typically record these long videos over multiple days, I just edit it all together and make sure I use the same shirt when I record lol, that way it all seems more seamless to the viewers.

  • @neilhohmann10
    @neilhohmann10 ปีที่แล้ว

    Another helpful SOQL function is FORMAT(). If you wrap a currency, number, or date,/time field with it, it will make those fields more reader-friendly. For instance, it will add the currency denomination ($) and delimiters (eg, 45000000 >>> $45,000,000): *SELECT Id, Name, FORMAT(Amount) FROM Opportunity*. You can also use it with aggregate queries: *SELECT FORMAT(MAX(Amount)) FROM Opportunity*.

  • @benimfavorilerim
    @benimfavorilerim ปีที่แล้ว

    Thanks.. It is really a reference tutorial. ::: + :)

  • @fatihgulsun5
    @fatihgulsun5 ปีที่แล้ว

    Hello you are great and your lessons great too thank you for all of the hardwork.Even when my query is correct, it's underlined in red, and it's driving me crazy. What can we do about this issue? I bought Intellij with your advice. But I guess the system there is not the same as in the developer console. I can't reach some of the things that I can reach in developer consel, I guess because I don't know how to use intejij.

  • @gauravjain6159
    @gauravjain6159 ปีที่แล้ว

    Thank you for this great video. One comment about lookup SOQL query from parent to child. If its custom object then Child Relationship Name which is available in UI , has to be appended with __r when you query, right?

  • @funklion
    @funklion ปีที่แล้ว +1

    One thing I was hoping to see but didn't: how to work with the outputs of sub queries returning more than one object in apex. You showed how a regular query or one that uses parent fields can be put right into a list, but I didn't see anything about the more complex types of results in apex.

    • @funklion
      @funklion ปีที่แล้ว

      Edit: I do see the SOSL List part now not sure how I missed that before. Cool!

  • @srikanthreddyboreddy8524
    @srikanthreddyboreddy8524 ปีที่แล้ว +1

    please guide me best salesforce text in amazon

    • @CodingWithTheForce
      @CodingWithTheForce  ปีที่แล้ว +1

      They are in the comments in all my videos, but my favorite for beginners will always be Advanced Apex by Dan Appleman. It is an excellent book and really helped me get started out on the right foot many years ago.