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
2
votes
1 answer

Timezone change in SOQL query

I am running a SOQL query and getting a date/time field value as per user's timezone. I have a requirement to change the timezone in EST in the SOQL query itself. For example: User is in PST and while running SOQL query I am getting createdDate…
ankit agarwal
  • 21
  • 1
  • 2
2
votes
1 answer

Left Outer Join SOQL

I have the following entities: .. ... ... ..
cloudy_weather
  • 2,837
  • 12
  • 38
  • 63
2
votes
2 answers

SOQL Query to fetch more than 2000 records

How to fetch more than 2000 records through SOQL .... Is there something query more ?
Priya
  • 29
  • 2
  • 6
2
votes
1 answer

How to properly escape special characters (like - ') in SOQL queries from Java code?

I have a Java class where I construct SOQL queries using String concatenation. Is there any best practice which someone can suggest to escape SOQL special characters like single quotes?
vivek_ganesan
  • 658
  • 4
  • 19
2
votes
2 answers

How to get SOQL inner query as strongly-typed object (C#)

I'm new to Salesforce development, and trying to figure out SOQL stuff. Long time listener, first time caller. I am running a SOQL query on ActivityHistories, and attempting to get it as a custom object. I need to do this so I can bind the data to…
2
votes
2 answers

How to get Account.Name when Selecting Tasks in Salesforce SOQL

I am dealing with an SOQL query in Salesforce like SELECT Id, Subject, Who.Name FROM Task I need to know the Who.Account.Name in the same Query How should I do that?
lowcoupling
  • 2,151
  • 6
  • 35
  • 53
2
votes
2 answers

Salesforce: Getting the “Non selective query” error on a selective query

I'm running a very simple SOQL query which I've renamed objects and included here: List allRecords= [ select name, Id,Contact__c,... from ObjectA__c where Contact__c IN (SELECT Contact__c FROM ObjectB__c WHERE id IN :idList)…
ScriptMonkey
  • 131
  • 1
2
votes
1 answer

Accessing Salesforce and querying from a Rails app

I'm trying to implement a feature into a rails app where a user can enter a "referral id" (a custom field in salesforce) and the app will retrieve the status of their referral. I've been trying to set up the REST API Oauth2 authentication for it but…
wldcordeiro
  • 123
  • 1
  • 9
2
votes
1 answer

Account Trigger update all contacts - Too many SOQL queries: 101

I have a trigger that runs after updating any account and it actually just updates a field (Relationship_category_r__c) in all the related contacts after few conditions. Condition1: If we update the account type to "Member" Condition2: If the…
user3454099
  • 21
  • 1
  • 2
2
votes
0 answers

activity aggregate relationships only allow security evaluation for non-admin users when a single parent record is evaluated

I am getting the following error when I run s Salesforce SOQL query with a standard account. Query: SELECT ( SELECT Id, Subject FROM OpenActivities ORDER BY ActivityDate ASC , LastModifiedDate DESC LIMIT 500) FROM Account WHERE Id in…
R.Epstein
  • 61
  • 1
  • 5
2
votes
1 answer

Salesforce SOQL statement

I'm using Salesforce and trying to write a SOQL statement. My tables look like: Person: [id, name] Related: [id, personid1, personid2] In sql, to find all the people someone is related to, I might write something like: select person2.name from…
user1333371
  • 598
  • 3
  • 13
2
votes
1 answer

Salesforce SOQL Filter by child relationship

I have the following simple query which shows I can access the field I want to filter by: SELECT Id, Name, (SELECT HC4__IsSearchableExternally__c FROM Contacts) FROM Account However, what I really want to do is return only the Id and Name…
JKasper11
  • 772
  • 1
  • 7
  • 21
2
votes
1 answer

Salesforce - Apex - query accounts based on Activity History

Hey Salesforce experts, I have a question on query account information efficiently. I would like to query accounts based on the updates in an activityHistory object. The problem I'm getting is that all the accounts are being retrieved no matter if…
Mohamed Farag
  • 139
  • 1
  • 5
  • 15
2
votes
2 answers

Retrieving Contact.Email, Opportunity.Name and OpportunityLineItem.Quantity in one query

I'm trying to retrieve Contact.Email, Opportunity.Name and OpportunityLineItem.Quantity in a single SOQL query. Is this possible? If so, how? My query is: Select Opportunity.Id, Opportunity.Name, Contact.Email, (Select Quantity From…
Rainbard
  • 341
  • 1
  • 3
  • 12
2
votes
1 answer

searching comma separated list using SOSL with wild cards

Is it possible to use a SOSL query to search for Product Names in a comma separated list that still includes wildcards? For example, if you input a search string like this: productA, productB, productC Can I run a SOSL query that would return all…
Dman100
  • 747
  • 2
  • 23
  • 49