New answers tagged batch
0
votes
Which is a better approach when updating records using batch class, to place it in execute or finish method?
In Salesforce batch Apex, the best practice is to perform DML operations in the execute method, not in the finish method. This is because the finish method is intended for post-processing operations, ...
3
votes
Batch Apex Class Invoked From Before Delete Trigger is not deleting Files Attached to accounts
The query won't return any records, because the accounts will have already been deleted by the time your batch class has run. Instead, query for those files in the trigger, and use a batchable, if you'...
2
votes
Batch Apex Class Invoked From Before Delete Trigger is not deleting Files Attached to accounts
If the execute of your batch class is not running, but the finish is, it means that the query in the start is returning zero results.
Your batch class will be running asynchronously, so it will be ...
1
vote
Dynamic SOQL Error: Unexpected Token ':' - I have searched for two days, what could I be missing?
You can use String join to fix the issue.
String selectList = String.join(fields,',');
String soqlQuery = 'SELECT ' + selectList + ' the rest of the query... ';
0
votes
Accepted
Can we do DML in batch APEX start method
The batch Apex's start method is used to collect the records or objects to be passed to the execute method for processing. It is not recommended to insert records in the start method, as it may cause ...
2
votes
How to fix Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch
I believe you misunderstand how a batch class works. The batchable interface is used for tasks that should be performed asynchronously and when the system has enough computing resources to do it.
With ...
Top 50 recent answers are included
Related Tags
batch × 2005apex × 1389
schedulebatch × 249
scheduled-apex × 229
unit-test × 196
soql × 143
trigger × 130
governorlimits × 105
callout × 90
asynchronous × 61
code-coverage × 53
future × 53
visualforce × 45
class × 45
query × 36
email × 33
dml × 33
rest-api × 32
stateful × 30
error × 28
exception × 28
asyncapexjob × 27
limits × 25
scheduled-job × 25
singleemailmessage × 24