You need to sign in to do that
Don't have an account?
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?
Thanks
Vamsikrishna B.
Any suggestions?
Thanks
Vamsikrishna B.
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) {
mapAccount=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,
https://developer.salesforce.com/forums/?id=906F0000000kE3fIAE
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.