salesforce logo

If you are looking for salesforce consulting services then

Contact here

How to run a SOQL query in Salesforce

SOQL(Salesforce Object Query Language) is used to fetch the data from Sobject in salesforce organization. It is similar to Structured Query Language(SQL).

It will help you in retrieving and manipulating data, In this you can't specify * as for all the fields that are used for other SQL languages. Hence you must specify an exact field you want to get the information about.

With SOQL we can build powerful query strings in Apex statements, in Visualforce controllers and getter methods, in the Schema Explorer of the Force.com IDE.

Syntax looks like,

SELECT fields FROM object WHERE condition

Executed query is going to return you the list<Sobjects> as a result.

How to run a query:

1. Open developer console in salesforce org.

2. Click on the Query editor option in Developer console.

3. In Query editor, execute the Query.

If the Query generates errors, they are displayed at the bottom of the Query editor panel.

Note:

If you reexecute Query changes, which are unsaved in the Query grid are lost.

To reexecute a Query click refresh or get the Query from history and execute it.

Dynamic SOQL:

Query has to be formed based upon the data user is entering in the Salesforce organization.

SOQL usage:

Use SOQL when you want to retrieve data from a single object or from multiple objects, which are related to one another.

We can use it to retrieve data from checkbox fields, dates or numbers.

Can count the number of records, which meet specific criteria in an organization.

We can get results by sorting them with queries.

Note:

Up to 50,000 records can be retrieved using SOQL queries.

In a SOQL query with parent-child relationship sub queries, each parent-child relationship count as an extra query. These types of queries have a limit of three times the number for top-level queries. 

There are location-based SOQL queries, which are used to calculate distance between two location values or distance between one location value and latitude-longitude value.

Micropyramid helps to fix all your salesforce projects issues. Knowing all the rules about workflow, our experts can help you in setting up the outbound messaging by automating the emails, tasks, outbound message actions, and field updates. Looking for salesforce managed services? Get in touch woth us

About Micropyramid

Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.


Posted On 30 October 2017 By MicroPyramid


Need any Help in your Project?Let's Talk

Latest Comments

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties