function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mjohnson-TICmjohnson-TIC 

Query Related Who OwnerId Through API of Task

Hi All,

 

Does anyone know if it is possible to query the related ownerid of the contact/lead record related to a task? I realise the "who" field of task is a lookup to the "name" object which is related to a user/contact/lead. Is the ownerid of the related user/contact/lead captured anywhere on the "name" object (I did not see it under standard fields of the object) or is there any shortcut to get to this id without another select statement based on the whoid of the task? This query could potentially return results of hundreds of tasks so I am hesitant to use an additional select statement if it is possible to retrieve this id an easier way.

Best Answer chosen by Admin (Salesforce Developers) 
AmitSahuAmitSahu

I think you have to use the second query.There is no direct relation..