How to change parent (eg Account 'IBM' has 3 contact ..A,B and C ..... ) Contact A,B,C have to reparended to other Account 'HCL' ...Can it be done by process builder or apex code??
Apex will be easier as process builder needs to be triggered.
Id acctId = [select id from account where name = 'HCL' LIMIT 1].Id; List<contact> contactlist = [SELECT accountid from contact]; //add where clause where applicable for(contact c: contactlist) c.accountid = acctid;
Id acctId = [select id from account where name = 'HCL' LIMIT 1].Id;
List<contact> contactlist = [SELECT accountid from contact]; //add where clause where applicable
for(contact c: contactlist)
c.accountid = acctid;
update contactlist;