I have written a trigger helper method that converts to contact and associates the contact with an existing account. The contact owner becomes the owner of the account as shown in this snippet
Now I dont know how to cover this assignment: c.OwnerId = c.Account.OwnerId;
I am getting the error :
Error occured while converting the Lead to a Contact in convertLeadToContact methodSObject row was retrieved via SOQL without querying the requested field: Contact.Account
Any ideas?
Thanks
// contains the list of created contacts after conversion
contList = [select Id, OwnerId from Contact where Id IN :cidList];
//update contact owner with related account owner
if(cidList.size() > 0){
for(Contact c : contList){
c.OwnerId = c.Account.OwnerId;
}
update contList;
}