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
ArchonArchon 

Relationship query for task and lead

I am trying to write a relationship query that will pull tasks along with the associated lead and owner.  I have a current query in production that works, but using sforce explorer returns an error that says "Query Failed: Length cannot be less than zero.  Parameter name: length"  Does anyone know what this error indicates?

This is my current query that works:

SELECT Id,
Subject,
ActivityDate,
Who.FirstName,
Who.LastName,
What.Name,
Status,
Priority
FROM TASK 
WHERE Owner.Email = '<email of owner>'
ORDER BY Priority


I'm trying to rewrite this to return values from the associated lead such as the lead id.  But, like I said, even the working production query is giving errors in sforce explorer.  The service url I am using is https://www.salesforce.com/services/Soap/u/10.0.  I tried using 9.0 and 8.0 and it still gives the same error.
NasipuriNasipuri

Hi,

 

The ‘Who” reference of a Task may be an Contact or Lead.

 

So if a specific Task is related to a Lead it will return Lead Id if you add ‘Who.Id’ in the SOQL. But from this SOQL relationship you can not get any further information related lead such as Lead Country or Lead Phone no.

 

Thanks,

Dinesh Nasipuri

ArchonArchon
LOL A direct copy/paste from sforce's own docs gives an error in the sforce explorer.  Using this query SELECT Name, (SELECT Subject from ActivityHistories) from Contact  returns an error. What a pile of crap.
SuperfellSuperfell
Probably just a bug in sforce explorer, have you tried downloading the current version ?
ArchonArchon
I don't see versioning on the app, so I'm not sure what version I'm using.  I downloaded it from sourceforge (http://sforce.sourceforge.net/).  If there is a newer, less buggy version that would be great.  Not even running the doc's sample is frustrating.  It seems like the only working queries are just a straight select from only 1 table.
SuperfellSuperfell
I'd follow the links from this page  http://wiki.apexdevnet.com/index.php/Tools
ArchonArchon
Thank you.  The new app exchange version works much much better.
Nathan HincheyNathan Hinchey
Is there still no way to do this?