Hot answers tagged

8

In Dynamic SOQL, you need to pay attention to spaces. There should be no space between : and what follows. Bad id NOT IN : setclosedId Good id NOT IN :setclosedId Spacing is important when building dynamic query strings, as the system is far less lenient in that case.


4

I assume, delete dml invokes some trigger in managed package, which throws an SOQL limit exception. Overall, it is possible to use dml not for the single record, but for the collections of the records. Move delete prog; outside of the loop trigger ProgTrigger on hed__Program_Enrollment__c (before insert) { list<hed__Program_Enrollment__c> ...


4

Seems quite likely related to VerificationHistory. I would guess the "fields" just indicate whether or not a record exists with the given Activity specified. Notice the values for that picklist: The action the user attempted that requires identity verification. The label is User Activity. Available values are: AccessReports—The user attempted to ...


3

You can execute the query written on the Apex class by following the below step: https://trailhead.salesforce.com/en/content/learn/projects/quickstart-vscode-salesforce/use-vscode-for-salesforce


3

Lucky for you, Salesforce changed the way query aggregation counts against your limits recently, so you can drop the child query altogether. Just use aggregate queries instead. Before, every record which went into the aggregation counted against you, but now only every aggregation counts. public with sharing class MyRollupBatch implements Database.Batchable&...


3

It's a Date Literal. You need to merge it in as such. Rather than using a bind variable, you need to actually include the string so it results in your dynamic SOQL containing a Date Literal. String soql = '... WHERE CreatedDate = LAST_N_MONTS:' + x; Effectively, what you had would output: SELECT ... FROM ... WHERE CreatedDate = 'LAST_N_MONTHS:42' But ...


2

this concept is called SOQL For Loops. The main idea here is using queryMore() by saving queryLocator to retrieve another chunk of records and not to store them in a heap. Pay attention, that you can use soql for loop only for objects, that supports queryMore call. You have to use soql for loop in cases when you don't need to store selected records in ...


2

I would recommend you to use Batch but without querying sub-records, this could lead to unpredictable errors, especially if you have 200+ of them. Try to rewrite your query in the next way: public Database.QueryLocator start(Database.BatchableContext context) { return Database.getQueryLocator([ SELECT Id FROM Child__c WHERE Parent__c IN :(SELECT Id ...


1

Unfortunately, I think SOQL is no help here as Tabs and TabSets are not available for queries. This URI: https://ap2.salesforce.com/services/data/v29.0/appMenu/AppSwitcher Can you get a list of TabSets including the 'Sales' one but apart from navigating to the tab sets record page using its ID, there again isn't much you can do with this. The Apex Schema ...


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