
3 respostas

Hi natalia check this code
set<id> set1=new set<id>();
list<contact>conlist=[select id,name from contact where name='Ashok143'];
for(contact con:conlist)
{
set1.add(con.accountid);
}
list<account> acclist=[select id,name from account where id in:set1];
for(account acc:acclist)
{
acc.name='ram';
update acc;
system.debug('account record is'+acc);
}
//accountname=ashok143
let change the account name as Ram