Run BatchClass To Test Only One Record From Anonymous Window

Batch Class Name : updateAccountBatch
Record Id for which we want to run batch class : 0010K00001k4YIo

Create instance of batch class.
Pass parameters to execute method in batch class.
Pass null to first parameter Database.BatchableContext BC
Pass soql with hardcoded record id to second parameter List<sObject> scope

Solution 1:

updateAccountBatch updateBatch = new updateAccountBatch();
updateBatch.excute(null,[SELECT Id,name from Account Where Id = '0010K00001k4YIo'])

Solution 2:

new updateAccountBatch().execute(null,[SELECT Id,name from Account Where Id = '0010K00001k4YIo']);

Comments

Popular posts from this blog

Syncing And Unsyncing Quote With Opportunity Using Flow And Process Builder