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.
1
vote
1
answer
3k
views
SOQL: Access Referenced object from a lookup field
Meaning I could now SOQL any related custom objects using the plural API name and a "__r" suffix like so:
SELECT Id, (SELECT Id FROM Customs__r) FROM Opportunity
But for my scenario the question was …
1
vote
Accepted
SOQL: Access Referenced object from a lookup field
In this instance you can refer to the singular API name with a "__r" suffix without needing a nested relationship query, like so:
SELECT Id, Opportunity__r.CloseDate FROM Sale__c
As mentioned here: …
0
votes
1
answer
245
views
SOQL: Too many query rows even when only 1 is returned
I have tried putting SOQL in a loop as suggested here as well and I still get System.LimitException: Too many query rows: 50001
All post on this topic mention setting a limit below 50k which I have tried … The SOQL is still going to search all 350k+ CampaignMembers.
Note: Developer Console returns 1 row, but execute anonymous returns 50k+ (same SOQL) …
1
vote
1
answer
477
views
Map all data columns of a SOQL response
For example I have a nice SOQL here that returns a column for Contact, Quote, and CampaignMember (each row tranversed by ContactId)
Map<Contact, Quote, CampaignMember> masterMap = [
SELECT
Id, … (SELECT Id, Name FROM Quotes),
(SELECT Id FROM CampaignMembers)
FROM Contact
WHERE Id IN :contact_list
]
How do I store the result from a SOQL like this in a way I can use? …
2
votes
Accepted
Map all data columns of a SOQL response
Ok I think I found a solution that works, thanks to this post
Map<Id, List<Quote>> QuoteMap = new Map<Id,List<Quote>>();
Map<Id, List<CampaignMember>> CampaignMemberMap = new Map<Id,List<CampaignMemb …
3
votes
3
answers
2k
views
SOQL: Recent date grouped by AccountId
OBJECTIVE
I am simply trying to return the most recent activity for a given list of accounts: List<Id>. I just want 1 row for each Account ID that gets passed. For each row I need the ActivityDate an …
0
votes
SOQL: Recent date grouped by AccountId
So far I have not found this to be possible in SOQL alone so for the time being I have a list of all Activities for all included accounts (from the Trigger) ordered by ASC so that I can iterate through … */
List<Task> account_touch_tasks = listActivitiesByAccountId(accountId_set, 'Task', 'none'); /* 1 SOQL */
if(! …
1
vote
Accepted
What is the coalesce() eqivalent?
Based on @sfdcfox's answer I decided the only option to accomplish what I needed was to abandon SOQL aggregate columns and handling AggregateResult object. … Instead because requirements of this task (need AVG of all invoice opportunities, but MAX of only unpaid invoice opportunities), also in order to avoid some complicated version of multiple SOQL statements …
2
votes
2
answers
3k
views
Merge Data from Multiple List<SObject> for use in Update/Insert
already worked through my trigger/filtering logic and now I have a list of affected campaign members:
List<CampaignMember> campaign_members = CampaignUtils.listCampaignMembersByWhoId(whoId_list); /* 1 SOQL …
6
votes
1
answer
5k
views
SOQL: How to handle relationship query with more than 50,000 results
ISSUE:
I have a SOQL of that returns a reasonable amount of rows of Campaign based on Contact Ids (i.e. 200 batch of contacts maybe 1000 connected Campaigns) But it also returns an relationship query … QUESTION:
Do I need to use Batch Apex for this one SOQL? If so any idea how I would do that? …
4
votes
2
answers
6k
views
What is the coalesce() eqivalent?
Much like this post here: SOQL: Avoid count with NULL results return 0 (zero) instead
I have an instance where I am using aggregate functions like COUNT() and MAX() on a collection of Opportunities. … Here is an example of my SOQL:
SELECT AccountId, COUNT(Id) Invoices, AVG(Days_Past_Due__c) Average, Max(Days_Past_Due__c) Max
FROM Opportunity
WHERE AccountId IN :accountIds
AND IsDeleted = FALSE
AND …
1
vote
1
answer
755
views
Convert an array of ids to a csv string with quotes
inputs.param1 = "some_value"
inputs.param2 = "1209845, 2348425876, 2958263459, etc"
In Chrome developer tools it looks like this
But now I need to use the "Ids" parameter to make up a dynamic SOQL …
3
votes
2
answers
254
views
How can I filter through object using 2 separate fields as unique identifiers?
I have a custom object (we'll call it RS__c), and it theoretically has a 1 to 1 relationship to OpportunityLineItems (it is not possible to create a reference field directly to create this relationshi …
2
votes
Accepted
How can I filter through object using 2 separate fields as unique identifiers?
I DID IT!
As suspected towards the end of my OP, I created a separate formula field, (i.e. RS__c.Sync_Id__c), which concatenated the QB Id and the Product Id (18 character version). Once I had that i …