13
votes
Accepted
How deep can nested Maps go, and how do I properly add data to those nested maps?
There is a nested limit of 7 collections. If you attempt to go beyond this, you'll get an error:
Nested type exceeds maximum level: 8
First question: Is this even possible? Am I exceeding any ...
11
votes
Accepted
Lightning component event not fired or handled
When you use the pattern of:
<c:parent>
<c:child name="xyz" />
</c:parent>
Then you must use includeFacets="true" to make a component event from the child bubble to the parent ...
11
votes
Accepted
SOQL: Comparing two custom relationship fields in a nested query
Ahh, Salesforce doesn't allow direct field to field comparisons in a query. Source:
Field to field comparison in WHERE clause of SOQL
Knowledge Article Number
000187460
Description
...
9
votes
Accepted
Formula Field - Case Function
If function will work inside the case statement in formula
You can do like this:-
CASE( sa_nket__case_text__c ,
'00', 'Member',
'02', 'Member',
'03', 'Member',
'99', 'Member',
'23', IF( ISBLANK(...
6
votes
Accepted
How to parse nested objects in JSON response
I think you can address this effectively with a mix of collections and custom classes, like this:
public class countryLocale {
public String preferredLanguage;
public String preferredLocale;
...
5
votes
Accepted
Nested IF with PICKVAL
You had a spurious parenthesis resulting in closing an IF too early. I think this is what you're aiming at here (note the comment, which you shouldn't include in your formula):
IF(
ISPICKVAL(...
5
votes
Accepted
Why do I get an error on Quotes.Id in my SOQL query
You can't filter a child value like that directly, but you can use a subquery:
WHERE Id IN (SELECT OpportunityId FROM Quote WHERE Id = '0Q00E0000004PEESA2')
4
votes
Accepted
How can i create a Map for unrelated objects?
Your main concern shouldn't be the if statement, it's the fact that you've got a query inside a loop--if there's more than 99 shadow contacts on an account--boom, you get an uncatchable error. ...
4
votes
Accepted
Nested query doesn't work
edit:
So the question ended up being about simple salesforce (python) and thus running this query through the REST API.
Having multiple levels of subqueries was introduced in Summer '23 (api v58.0), ...
3
votes
How to avoid nested loop in the trigger
let's assume, you have only one Support_Settings__c record per each Case RecordTypeId field value. In this case, in order to avoid nested loops, you can group Support_Settings__c records by ...
3
votes
Accepted
Avoid specifying an outer class when using its nested class outside
You can't, unfortunately. Apex does not have an "import" function that you might expect from another C-family language, Python, etc. ClassA.NextedInA is going to be called exactly that everywhere ...
3
votes
Accepted
Custom Object Nested Query on Standard Object
You can find the relationship name by running a script like this one:
for (ChildRelationship relation : SObjectType.Case.getChildRelationships())
if (relation.getChildSObject() == MyObject__c....
3
votes
Accepted
Nested For Loop and SOQL Best Practice
Three nested for loops are not a problem per se. The issue is how these loops have a multiplicative effect on limits consumption by either dramatically increasing the computational complexity of your ...
3
votes
Accepted
Nested IF formulas for a simple logic field on the opportunity
Try this:
IF(
AND(
Department_MQL__c <> 'SDR generated, relationship management',
Department_SQL__c = 'SDR',
ISPICKVAL(Account.Sector__c, '<>Supplier/Distributor')),
...
3
votes
Accepted
Spurious parenthesis issue in Nested IF statement (continued)
You're missing one comma.
IF(
ISPICKVAL(Sector__c, "Supplier/Distributor"),
"Supplier",
IF(
ISPICKVAL(Account_Region__c , "Middle East"),
"Middle East",
IF(
ISPICKVAL(...
3
votes
Accepted
SOQL API query with custom objects and relationships. Returning a flat result - Not nested
That's how the API works. This is true for both REST and SOAP calls. If your software can't handle it, you need some middleware to translate the results. If you can call an executable, Salesforce CLI (...
3
votes
Accepted
Json Unexpected character (':' (code 58)): was expecting comma to separate ARRAY entries at [line:1, column:83]
The error message is helpful here, line 1, column 83 puts you at "Name":"Java"
From the previous entry in the list, it's clear that you're missing an object start { after the "...
3
votes
Accepted
System.NullPointerException: Attempt to de-reference a null object on a Collection
When you create a new ArrayOfEntityReports_EntitySearchCriteria, it contains an uninitialized Data_Contract.EntityReports_EntitySearchCriteria[], which means that class variable is null.
A null/...
3
votes
Dynamic nested soql - how to loop through subquery?
Given you have the child relationship name (i.e. "Contacts" in your example), my first attempt was to simply use SObject's get() method, like you would with any other field.
String query = '...
2
votes
Accepted
Compare Value of One Map with Key of Another Map to create new Map?
Yes, there is.
You can use the containsKey() method of the map class.
if(groupDefinitionIds.size()>0){
// Iterate over just one of your maps
for(Id groupDefId: groupDefinitionIds.keyset())...
2
votes
Save a nested query into a Map
UPDATE
If you want to group CaseComment records by Case.AccountId, the following makes more sense:
Map<Id, List<CaseComment>> accountIdToComments = new Map<Id, List<CaseComment>&...
2
votes
Accessing fields from nested SOQL and exposing them in Visualforce
There's a problem with the query you're asking us about.
List<Object1> obLis=[SELECT Id, Name,
(SELECT Id, Name FROM Object2), (SELECT ID, Name FROM Object3];
If the relationship exists as you ...
2
votes
Accepted
Hot to get value of relationship dynamic Soql
sobjList is a generic List<sObject>. The sObject class has no property Case__r, and Apex does not resolve properties like this at runtime.
The easiest way to handle this is to declare the ...
2
votes
Accepted
How to deserialize object with nested query in a simply way
You are right. It does not show up on the logs when you check it. However, the reality is, if you try to reach to child object by following script, it does return you the record array for the child ...
2
votes
Accepted
SOQL UserName and UserRole
The error is pretty straightforward. If you want to reference a field from a queried record, you need to include that field in the SELECT clause.
In this case, that means including UserRole....
2
votes
Accepted
Create component used to include other components or static resources
Imported scripts are isolated to the component in which they were imported in to. This is a security feature. Behind the scenes, each component gets its own window object instead of the global window ...
2
votes
Accepted
Nested tables with different headers and data LWC for:each
Here's what worked for me. I'm pretty green so there's probably a cleaner way, I created a child component with the products:
<template>
<table>
<thead>
<...
2
votes
SOQL nested query not working
you need to use a single "=" , not double "==" . Please refer to the SOQL documentation
2
votes
Invalid key error, when clicking on a combobox from a nested component
This error is coming from the lightning-combobox component rather than your custom component. I'd suggest debugging the code that creates the options array as it appears you haven't set the value ...
2
votes
Accepted
Nested Query Dot Notation or Name Casting
You can use aliases to write shorter queries. The example in the docs say:
SELECT count()
FROM Contact c, c.Account a
WHERE a.name = 'MyriadPubs'
Here, we specify Contact as c, allowing us to write ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
nested × 92apex × 30
soql × 30
query × 15
formula × 13
map × 9
if × 9
lightning-web-components × 8
loop × 8
visualforce × 6
formula-field × 6
json × 5
relationships × 5
trigger × 4
lightning-aura-components × 3
lightning × 3
master-detail × 3
table × 3
conditional × 3
for × 3
rest-api × 2
custom-object × 2
case × 2
class × 2
list × 2