+ Start a Discussion
srinivas pulipatisrinivas pulipati 

How to insert the phone number in particular contact record by using batch apex program?

please tell me the  answer

Thank you
Hi srinivas ,
You want to insert or update phone number for a contact .
if you want to assign phone number of update phone number for a particular contact ,Assume contact name is  Srinivas.
Try with belwo code it will work .
global class ContactPhoneUpdateBatch implements Database.Batchable<sObject>{
    global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT Id,Name,Phone FROM Contact';
        return Database.getQueryLocator(query);
    global void execute(Database.BatchableContext BC, List<Contact> scope){
         for(Contact con: scope){
         update scope;
    global void finish(Database.BatchableContext BC){ }
Check below link for more detail about batch apex .
Let me know if it helps

srinivas pulipatisrinivas pulipati
But Contact number is not insert in perticular record

i Am write in  Execute Anonymus: Database.executeBatch(new BatchContactUpdateRecord());

but number is not inserted