+ Start a Discussion
Puja Patil 13Puja Patil 13 

Bulk data importing error

I have to import more than 1500 records in custom object by using dataloader.io , but following error occures in importing :
ERROR: icad.ICADNCPASort: System.LimitException: Apex CPU time limit exceeded
and by using import wizard
ERROR : System.LimitException: icad:Too many DML statements:151
but there is no any trigger or class in org and no any DML estatment used.
SandhyaSandhya (Salesforce Developers) 

this error depends on the resources available in the backend. For example, when the end user was uploading data, there may be some batch jobs running in parallel in background due to which the number of resoruces available for data load operation became less and the CPU error occured. On the other hand, when you tried uploading data, there was nothing executing in background and the upload went fine. 
To avoid such kind of issues, you should follow the best practices while coding your triggers. The  trigger might have some piece of code like a for loop inside a for loop which generally causes CPU time out exception when large number of records are uploaded. For now, you can do either of the 2 below listed things:
1) Optimize your code and scan it through some code scanner tool like Checkmarx which will catch any vulnerability present in code.
2) If optimization of code is not possible, then educate end users to reduce the batch size of dataloader before uploading the data. The default batch size if 200, you may reduce it to 100 and then try uploading the data. If you still face the CPU timeout exception, reduce the batch size further until the error goes off.

Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards