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;: 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
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
contList = [select Id, OwnerId from Contact where Id IN :cidList];// contains the list of created contacts after conversion
//update contact owner with related account owner
contains the list of created if(cidList.size()contacts >after 0){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;
}