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
muthu.swimuthu.swi 

Contact/Account details in Task

Hi to all,
 
Is it possible to get contact/account details in a soql query applied on Task?  Something like this:
 
Select Id, Contact.Name, Account.Name From Task
 
where Task has reference to Contact and Account on WhoId and WhatId. When I tried this query I am getting the error:
 
INVALID_FIELD - Didn't understand relationship 'Contact' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Is there any other way to get contact/account details without using a seperate soql query?
 
Thanks in advance.
 
*Muthu*
Ron HessRon Hess
this works for me in the soql browser (appexchange.schema in Eclipse)

Code:
Select t.Who.Name, t.Who.FirstName, t.Who.LastName, t.WhoId From Task t

 

muthu.swimuthu.swi

Thanks a lot :smileyhappy:

*Muthu*

Saurabh_RawaneSaurabh_Rawane
How about getting the account name,if i am not using whatid relationships,

Select Account.Name from Contact -- works

Select Account.Name from Task -- doesn't work

Is there a way to go about it.

Thanks,
Saurabh