You need to sign in to do that
Don't have an account?
Subodh shukla
Batch Class Not Updating Account Field
Hi,
In my batch class i have to populate Account Object field Account_Field__c with contact id when these field(field Account_Field__c) is null. I have tried above piece of code but it is not updating the field.
Thanks in advance
In my batch class i have to populate Account Object field Account_Field__c with contact id when these field(field Account_Field__c) is null. I have tried above piece of code but it is not updating the field.
List<Contact> contactList = new List<Contact>(); List<Account> accountList = new List<Account>(); accountList = [Select Id,Account_Field__c from Account]; contactList = [Select Id from contact where AccountId in :accountList]; for(Account a:accountList){ if(a.Account_Field__c == null) for(Contact c:cntList){ a.Account_Field__c = c.Id; accountList.add(a); } } } update accountList;
Thanks in advance