You need to sign in to do that
Don't have an account?
sales@myvarma
batchapex to update website value in every account
how to update every account with same website value
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
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.