You need to sign in to do that
Don't have an account?
Superdome
[Apex Design Pattern] Too many dml rows:10001
Like to do a update with more than 2,000,000 records in the developer console.
Is the pattern workable to do the task ?
Boolean onOff = true;
while(onOff){
onOff = asyncApex.doUpdate();
}
----------
global class asyncApex {
@future
public static Boolean doUpdate() {
List<Object> recs = [ select id, name from Object LIMIT 10000];
List<Object> rUpdate = new List<Object>();
for(Object o: recs){
Object t = new Object();
....
rUpdate.add(t);
}
update rUpdate;
if(recs.size()==0) return false; else return true;
}
}
Best Answer chosen by Admin (Salesforce Developers)
Dhaval Panchal
You can use batch apex.