New answers tagged

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, ...
Tushar Jadav's user avatar
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'...
sfdcfox's user avatar
  • 481k
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 ...
fred's user avatar
  • 2,753
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... ';
Ken's user avatar
  • 176
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 ...
Tushar Jadav's user avatar
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 ...
Renato Oliveira's user avatar

Top 50 recent answers are included