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
2 votes

Executing SOQL with User Mode and then DML with user Mode causing Exception

My_Rule__c appears to be a master-detail relationship field with reparenting disabled. For some reason, supplying the same value as what is already in the field still causes this error, because the ...
sfdcfox's user avatar
  • 481k
1 vote

I'm trying to bulkify the update of parent field based on child

You are querying the rooms by their name instead of their database identifier. Instead of WHERE Name IN use WHERE Id IN. An improved version of your snippet, with an early return and a more selective ...
Renato Oliveira's user avatar

Top 50 recent answers are included