function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tobias Letzner 5Tobias Letzner 5 

Limit error in DML?

Hi,
I want to query all record and update it. But its show error when the records are more that 10000 any solution for that??

 
Suraj Tripathi 47Suraj Tripathi 47
Hi Tobias Letzner,

You can refere the below link with best example.
Link :- https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_batch

In case you find any other issue please mention. 
If you find your Solution than mark as this as a best answer. 

Thanks and Regards
Suraj Tripathi.
CharuDuttCharuDutt
Hii Tobias letzner
Try The Below Batch Class
EXAMPLE
public class LeadProcessor implements Database.Batchable<sObject> {
    public Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator('SELECT id,leadsource FROM lead');
    }
    public void execute(Database.BatchableContext bc, List<lead> records){
        for(lead led : records){
           led.LeadSource = 'Dreamforce';
        }
        update records;
    }
    public void finish(Database.BatchableContext bc){
        Id job = bc.getJobId();
    }
}
Please Mark It As A Best Answer If It Helps. 
Thanks You!
 
Emma AvaEmma Ava
DML is different to SOQL.
SOQL is the query language used to return rows whereas DML is the process typically used to insert, update, upsert or delete records.

Thanks. Regards: Sehhaty (https://www.expatsinsaudia.com/sehhaty-app)
jones brownjones brown
I am also looking for a DML solution because I am also trying to insert a new record and update it into the database. But there is a limit error. I think after Implement the Batch Class I will be able to update my record. Thank you so much for your valuable answer. You can get rid of all your difficulties, can Buy cbd oil hong kong (https://www.rebounce.co/), and feel rebounce. 
 
drigger speidrigger spei
DML is different from SOQL. SOQL is the query language used to return rows, while DML is the process normally used to insert, update, update, or delete records.
Regrads: customised cake singapore (https://aftersbakery.com/)
jackob yuosfjackob yuosf
SOQL is the query language used to return rows, while DML is the process typically used to insert, update, update, or delete records.
Regrads: Best Backpack Vacuums (https://justiry.com/best-backpack-vacuums/)