Hot answers tagged


Instead of for (List<AggregateResult> agg: query) you should have for (List<AggregateResult> agg: Database.query(query)). You can find additional detail regarding Dynamic SOQL here. Best regards!


If you haven't read through it already How do I bulkify queries for directly or indirectly related records is a good place to start. The general idea is that you need to first gather the data that you're going to use in the WHERE clause of your query (using a loop) and then perform your query (outside of all loops). You can then iterate over the results. ...


Gather leads' emails in Trigger. Query all leads with these emails. Store them in map which connects lead email with leads' ids. Run through your leads from Trigger once more: get stored leads ids related to current lead email, set duplicate links (check if current lead id does not equal to duplicate lead id). Set<String> emails = new Set<String>...


This is not readily available information. Multiple Automation Studio activities can populate a Data Extension -- Imports, Queries, Filter Definitions, Filter Activities. There's no way to search through each Automation without using the SOAP API or (WSProxy) to build some sort of inventory.


You need to add a where clause in SOQL for Account and use join to filter account record, example: SELECT Id, (SELECT id from MaintenancePlans WHERE Id = 'xxxxxxxxpUGAS') FROM Account WHERE Id IN (SELECT Account__c from MaintenancePlan WHERE Id = 'xxxxxxxxpUGAS') // Here I assume, Account__c is field API name and MaintenancePlan is ...

Only top voted, non community-wiki answers of a minimum length are eligible