Questions tagged [soql]

SOQL is the Salesforce Object Query Language.

SOQL, the Salesforce Object Query Language is a SQL like syntax used on the force.com platform to query records within a Salesforce instance. It can be used in triggers, or fully fledged Apex code, or via their web services API.

748 questions
3
votes
2 answers

Merge Data from different Queries without duplicates

I am getting data from three different queries via Api. I want data to be merged without the duplicate data. This is my function where i am merging the data: getStaffCount(data) { if (data == null || data.results === null ) return []; …
Manmeet
  • 39
  • 3
3
votes
4 answers

Hierarchial SOQL Query

Does anyone know how to retrieve the hierarchical model of a account based on it's id? I tried using this query but all i got is the first set of child nodes. select a.Name,a.parentId,a.ownerid,a.id from Account a where Parent.id ='00711314'
karthick
  • 11,998
  • 6
  • 56
  • 88
3
votes
5 answers

Salesforce SOQL Query for "Notes And Attachments" of a site

Basically, I need a single SOQL query, executable using the web service API, that will return all NoteAndAttachment items that would normally show in the Notes And Attachments section of an Account page in the Salesforce Web UI. This includes not…
KeithS
  • 70,210
  • 21
  • 112
  • 164
3
votes
2 answers

Pass a variable into a select query in SOQL

I am running a Python script that uses the simple-salesforce package to query all data in my Salesforce account. For context, the script reads a dictionary stored in a CSV file and stores a specific value, which is a string, in a variable (see…
Philosopher
  • 45
  • 1
  • 4
3
votes
1 answer

LIKE or CONTAINS in SOQL Query

I'm trying obtain some data from the following URL, using a JavaScript code: http://data.cityofnewyork.us/resource/erm2-nwe9.json That's how I construct my query: //data URL variables var start_date = '2013-08-01'; //YYYY-MM-DD var end_date =…
pceccon
  • 9,379
  • 26
  • 82
  • 158
3
votes
2 answers

Didn't understand relationship 'opportunity__c' in field path.

Select id, Account.Type from opportunity__c I create a custom object opportunity and make relational on Account__c and account data type lookup but above query does not run and give below error "Select id, Account.Type from opportunity__c …
Dilip Kr Singh
  • 1,418
  • 1
  • 18
  • 26
3
votes
1 answer

Force.com Toolkit for .NET class construct with QueryAsync when SQL query has a child/parent relationship

I'm running the following query which contains a child => parent relationship between Case and Account - and contains the Account.Name in the SELECT: string query = "SELECT Case.CaseNumber,Case.Account.Name,Case.Status FROM Case WHERE Status !=…
3
votes
2 answers

SOQL: Accessing the Contact Owner Field

I'm trying to write a SOQL query that will grab one of the Contact object's standard fields "Contact Owner", which is a Lookup(User) field: The field name is "Owner", but when I try to query SELECT Contact.Owner FROM Contact I get an error stating…
ZAR
  • 2,550
  • 4
  • 36
  • 66
3
votes
3 answers

How to do a Left Inner Join in Salesfoce

There are two tables in the salesforce schema +--------------+ +-------------+ | Case | | User | |--------------| |-------------| | CaseNumber | |id …
spuder
  • 17,437
  • 19
  • 87
  • 153
3
votes
3 answers

Maximum Size of List in APEX Salesforce

I have created a DataBase.Batchable class in which I am inserting a custom object named Event__c public class BatchCreateGCalendars implements Database.Batchable, Database.Stateful, Database.AllowsCallouts { private List
mathlearner
  • 7,509
  • 31
  • 126
  • 189
3
votes
1 answer

Salesforce SOQL INVALID_QUERY_LOCATOR exception

When i try to pull many contacts using SOAP API i get NVALID_QUERY_LOCATOR exception. INVALID_QUERY_LOCATOR exception occurre when any query having sub query takes a long time (more than 15 Mins) to execute at SF server and meanwhile SF DB object…
AtulRajguru9
  • 254
  • 7
  • 12
3
votes
4 answers

SOQL Aggregate query: Count number of rows returned

The following is my SOQL query: select COUNT(Id) FROM Payroll_Group_Detail__c where Tax_Batch__c=null and CreatedDate >=2012-07-21T00:00:00-05:00 and Total_Tax_Amount__c!=null GROUP By Company__c,Name,Payment_Date__c,Pay_Cycle_Type__c; I am was…
Richard N
  • 895
  • 9
  • 19
  • 36
3
votes
2 answers

Apex SOQL subquery in Visualforce

I am looking at showing a subquery SOQL query in an Visualforce page. This is my SOQL Expression. public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new…
Thys Andries Michels
  • 761
  • 4
  • 11
  • 23
3
votes
2 answers

soql join query in SalesForce

I'm struggling with a query, I want to select all Branches, and 'join' Companies (of type Account) with again the Contacts in there. Until now no luck, what am i doing wrong? SELECT b.Id, b.Location, (SELECT FirstName, LastName, FROM…
Bokw
  • 789
  • 1
  • 9
  • 21
3
votes
1 answer

Doing a join with SOQL

Here is my SOQL problem. Query 1: Select c.Date_Joined__c, c.Email, c.FirstName, c.LastName, c.regcode__c from Contact c WHERE c.regcode__c ='XXXXXXXXX' Query 2: Select p.Account__c, p.Date__c, p.Points__c, …
Womble
  • 57
  • 1
  • 1
  • 6