Salesforce Professionals, Admins, Consultants, End-Users – If you think SOQL = For Developers, you may want to reconsider. Using SOQL (Salesforce Object Query Language) you can talk to the data stored in your Salesforce Org in easy and yet powerful ways. How many records are there in Account object, how many Contacts exist for an Account, what is the count of Opportunities by stages – and many questions can be answered in less than a minute using SOQL. If you don’t know SOQL, you will be creating reports, getting the information and deleting these reports.
I have been planning to write a blog post on how to get started with SOQL (specially if you are a non-developer) and then came across this series of blogs by Kieren Jameson
Kieren has done a fantastic job of explaining SOQL in a three part series of blog posts.
- The first blog post introduces the basics of SOQL and can be accessed at URL http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-one/
- The second blog post explains how to link different objects together and pull data out and is available at URL http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-two/
- And in the third post you will dive into advanced features of SOQL like aggregates, advanced operators and wildcards, working with dates and numbers, and more advanced WHERE conditions. Check it out at http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-three/
Following these articles and practising it on your Salesforce org you can add the power of SOQL to your Salesforce skill set in less than a day.
If you are worried about screwing things up in your Salesforce Org by using SOQL, relax. Using SOQL you can only query the data and NOT insert, update or delete anything. And then Salesforce Governor Limits will act like a big brother to you. If you do write a query which is not optimized or tries to pull 100s of thousands of records, the big brother will stop you.
In the first part of the blog post Kieren has mentioned the tools (Developer Console & Workbench) that you can use to run SOQL. Here are some more that you can use to play with SOQL (Note that except for the first option of Developer Console, you will need to have the ‘API Enabled’ system permission to use all other tools)
- Developer Console – (Requires ‘View All Data’ or ‘Author Apex’ permission to access the tool)
- Force.com IDE – (Little complicated to use if you are not a developer)
- SoqlXplorer (for Mac)
- Force.com Explorer – (The tool hasn’t been updated since 2011)
- Cloudingo Studio
If you are not familiar with the SQL at all, you may want to check out this tutorial from Khan Academy on what is a SQL. This tutorial has got nothing to do with Salesforce. It just explains the concept of SQL in a series of nice videos.