+ Start a Discussion
vamsi krishna 106vamsi krishna 106 

Is it Possible to refresh Contact page when same contact was updated by bacth apex class?

Contact has open and i have batch class which update the same contact when bacth apex class updated then i need to refresh the contact details page. Either by using Lightning component or any other 

Any suggestions?

Vamsikrishna B.
AbhishekAbhishek (Salesforce Developers) 
Hi Vamsi,

Try this

global class BatchContactUpdate implements Database.Batchable<sObject>{

    List <Account> mapAccount = new List <Account> ();
    List <Contact> contactlist1 = new List <Contact> ();
    global BatchContactUpdate(List <Account> AccountUpdate) {
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return DataBase.getQueryLocator([SELECT Id, AccountID
                                         FROM Contact
                                         WHERE AccountID IN :mapAccount
    global void execute(Database.BatchableContext BC , List <Contact> contactlist) {
        for (Account acct : mapAccount){ 
            for (Contact con : contactList){
                if (con.AccountID == acct.Id){
                        contactlist1.add(new Contact(
                            Id = con.Id,
         update contactlist1;
    global void finish(Database.BatchableContext BC){

For your reference,


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.