You need to sign in to do that
Don't have an account?
Nishad Basha
How to query all the account created before 10 days and update their names in salesforce?
How to run the schedule Apex job before 10 days.How to solve the above solution please give some ideas.
Try below
date d = system.today().addDays(-10);
list<Account> accUpdateList = new list<Account>();
for(Account acc : [select id, name from account where createdDate = :d]){
acc.name = 'New Name';
accUpdateList.add(acc);
}
if(!accUpdateList.isEmpty()){
update accUpdateList;
}
All Answers
Try below
date d = system.today().addDays(-10);
list<Account> accUpdateList = new list<Account>();
for(Account acc : [select id, name from account where createdDate = :d]){
acc.name = 'New Name';
accUpdateList.add(acc);
}
if(!accUpdateList.isEmpty()){
update accUpdateList;
}
here iam asking the schedule apex class using query all the account created before 10 days and update their names
can you give me the example of scheduler class and add above code.please give the entire example code.
How to update the Account Names using Batch Apex before 10 days.how to solve above scenario please give some ideas.
Please go through
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm