+ Start a Discussion
Travis GorbahnTravis Gorbahn 

Secondary SOQL statement to find Task Owner / Assigner

Hey guys,

Hoping this is a quick one,

So I do a SOQL query like:

SELECT  Id, What.Id, Subject, Status, ActivityDate, Description FROM Task WHERE OwnerId ='MyAccountId' AND Status <> 'Completed

So now I have all the Tasks assigned to me - I want to find the User Name/Email that assigned it to me. I see that using the What.Id/Who.Id is Polymorphic - How would I go about my second query to determine the User Name/Email of the User that assigned me this task?

Much appreciated, 

Travis

 

AshwaniAshwani

This way you can find name of Assigner (Who). WhoId is polymorphic but still you can see Name.

SELECT id, Owner.Name, WhoId, who.Name FROM Task Where WhoId != null