1
votes

I've been trying to query leads that an event is assigned to so that I may get the lead's phone number, but this far the Phone field always ends up being empty, even if the Who.Name field is correct, as well as using the ID as a link to the record.. a simplified version of what I would like to do is:

SELECT Who.Phone FROM Event

But this returns nothing, if i do:

SELECT Who.Name, Who.Phone FROM Event

This will return an object with the correct name but not the phone. I'm really not sure where to move forward, it seems the only fields I may pull using this relationship are the Name and Id..

Am I using Who incorrectly or is there something I'm missing?

1

1 Answers

3
votes

The lookup fields on events are kinda special in that they can lookup to different types of record.

Maybe just grab all the IDs by querying for WhoId on event and then and then just run a second query on Lead with where id in : listLeadIds — I doubt adding another query in this instance will cause you governor limit issues.