global class batchAccountUpdate implements Database.Batchable<sobject> {
global Database.QueryLocator start(Database.BatchableContext BC) { String query='SELECT Id,Website FROM Account'; return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC,List<Account> Website) { List<Account> accList = new List<Account>([Select id,Website from Account]); for(Account acc : accList) { acc.Website = 'www.pradeep.com'; } update accList; } global void finish(Database.BatchableContext BC) { Account a = [Select Id, website from Account ];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'}; mail.setToAddresses(toAddresses);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
for(Account acc : accList)
{
acc.Website = 'YourWebsiteUrl';
}
update accList;
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query='SELECT Id,Website FROM Account';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,List<Account> Website)
{
List<Account> accList = new List<Account>([Select id,Website from Account]);
for(Account acc : accList)
{
acc.Website = 'www.pradeep.com';
}
update accList;
}
global void finish(Database.BatchableContext BC)
{
Account a = [Select Id, website
from Account ];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'};
mail.setToAddresses(toAddresses);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
You have written a nice code. Use it, it will work for you.