One scenario can be - When your trigger is not bulkified i.e can't handle list of records at once. By reducing the batch size to 1 will process all the records.
The maximum value of batch size is 2,000. Note the implication for a large parameter value: if an error occurs, all records in the batch are rolled back. In contrast, if the value is set to 1, each record is processed individually (not in batch) and errors are specific to a given record. We recommend setting the value to 1 when you need to diagnose problems with writing to a database.
Hope this will help you.
Please let me know if it helped or you need any more assistance. Please mark this is as the solution if it solved your purpose.
Hi Sohan, I dont think all the records in the batch are rolled back in the data loader. After you load data you will get 2 files, One is success and other is failure so failed records are will be moved to that files. Success records will be saved to DB.
Hi Sumit Kumar Singh, I believe it not good advice to write trigger for single record. It will be always bulkified. In that case what is impact of using batch size 1. Even batch size 1 or 2000 you can see the error for each records in the error file.
The maximum value of batch size is 2,000. Note the implication for a large parameter value: if an error occurs, all records in the batch are rolled back. In contrast, if the value is set to 1, each record is processed individually (not in batch) and errors are specific to a given record. We recommend setting the value to 1 when you need to diagnose problems with writing to a database.
Hope this will help you.
Please let me know if it helped or you need any more assistance. Please mark this is as the solution if it solved your purpose.
Thanks,
Sohan Raj Gupta
Hi Saravanan,
I didn't advise you to write a trigger for single record.You didn't get my answer.See the link and go throgh the comments/answers -
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kFUmIAM