Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Salesforce Object Query Language (SOQL), modeled on SQL, for accessing information saved in the Salesforce database.
25
votes
Accepted
Using SOQL apex bind variables for date literals (e.g. LAST_N_DAYS, TODAY, THIS_QUARTER)
I doubt it's allowed though (at least without having to use Dynamic SOQL). …
25
votes
Accepted
Trouble using SOQL to filter results by a range of Dates - What is the correct syntax?
CreatedDate is of DateTime type so your query must use the format from the very top of the article you've linked to: YYYY-MM-DDThh:mm:ssZ (optionally with timezones)
SELECT Id
FROM Case
WHERE Crea …
18
votes
Accepted
How can i get the id of the max record?
Why not with just a subquery?
SELECT Id, Name,
(SELECT Id, StartDate__c FROM Appointments__r ORDER BY StartDate__c DESC LIMIT 1)
FROM Contact
Keep it simple, aggregate functions "waste" query r …
14
votes
Accepted
SOQL - Obtaining Record Type Name
RecordType.Name
RecordTypes are held in separate reference table so to query the names just treat the RecordTypeId as any other lookup field :)
In case you've never used the "dot notation" (the way SOQL …
14
votes
Accepted
REST API query to get all accounts which have child records?
How about this?
Only Accounts with Contacts
SELECT Id, Name, (SELECT Email FROM Contacts)
FROM Account
WHERE Id IN (SELECT AccountId FROM Contact)
The subquery in SELECT optional of course (do you …
12
votes
Accepted
The "WHERE IN" clause SOQL
: is sufficient indication that you want to bind another variable.
List<OpportunityHistory> oppHistories = [SELECT Id, Probability, OpportunityID
From OpportunityHistory
where OpportunityID …
12
votes
Count a grouped by SOQL
Something like this?
SELECT Name, COUNT(Id)
FROM Search_Term__c
GROUP BY Name
ORDER BY COUNT(Id) DESC
LIMIT 5
(assuming you're storing the searched phrases in Name field)
Here's whole SELECT refer …
12
votes
Accepted
Whats the Actual meaning of ALL ROWS in SOQL?
Documentation around the Database.emptyRecycleBin (which essentially is what happens when you click the button in the Recycle Bin too) says "After records are deleted from the recycle bin using this …
10
votes
Accepted
How to get API partner server URL?
You mean something like https://na5.salesforce.com/services/Soap/u/28.0/00D70000000xxxx (API version and Org Id)?
Hardcode it ;) Or create a formula(text) field somewhere; sample value: $Api.Partner_ …
8
votes
how to compare time only from Datetime field in SOQL
Check the list of date functions and date literals. Something like this?
SELECT Id, Name, SystemModstamp
FROM Account
WHERE SystemModStamp = THIS_MONTH
AND HOUR_IN_DAY(SystemModstamp) >= 14
…
8
votes
Salesforce query on profile not working on user language change
You don't always to query in the controller for everything, some Profile fields are available in VF out of the box: {!$Profile.Name}.
This one is bit tricky because Profiles don't have DeveloperName …
7
votes
Skinny Tables - Salesforce
It makes sense to store this info in separate tables. There's only handful of standard fields and almost all of them are indexed. It's a good idea to have them in a table that doesn't change very ofte …
7
votes
SOQL Query Limit and Data Loading
In DataLoader (or other API tools) you can specify the batch size to be 30 ;) Means more round trips between the client and the server but this will make sure you stay within the limits. There's also …
7
votes
Accepted
Efficient SOQL query using IN binding with JAVA
If you know their IDs and are using SOAP API , retrieve is much better than hand-crafting SOQL :)
Otherwise I'm afraid you'd have to create full query yourself, ...WHERE Id IN ('001...', '001...', '001 …
7
votes
Accepted
find duplicate records based on multiple fields
This could be base of your query for duplicates:
SELECT COUNT(Id), AccountId, OwnerId, ActivityDate
FROM Event
GROUP BY AccountId, OwnerId, ActivityDate
ORDER BY COUNT(Id) DESC
LIMIT 10
Don't run it …