4

It looks like querying Task 'phone' is NOT supported. Can anyone confirm?

I can get Owner.Phone, but not read the phone field itself.

Acc. to this doc: Phone Phone number of the contact or lead associated with the task. This field is automatically filled in with the value from the corresponding contact or lead record.

  • Perhaps because it can't be queried because of the way sf is indexing it?

Please halp.

2
  • It's certainly odd that phone is listed as a standard Task field yet can't be queried directly.
    – Jagular
    Commented Aug 7, 2014 at 20:47
  • 1
    did your first sentence mean to say "...is not supported."
    – cropredy
    Commented Aug 7, 2014 at 22:49

2 Answers 2

3

You might try using the WhoId's relationship (Who.) to get to it.

SELECT Id, Who.Phone FROM Task
1
  • When I tried querying for Who.Phone, it didn't error but does not give me the phone number back. If I change it to Who.Name I get the expected result.
    – Jenny B
    Commented Aug 7, 2014 at 21:01
1

Similar to this post here, you will need to do two queries, one to get the task information and then one to get the contact/lead information. The phone field is not available in the schema in eclipse or when opening the object in the Developer console.
It looks like there is another option here, using TypeOf, but that would need to be enabled for your org by salesforce.

2
  • 1
    Phone is listed as a task standard field, yet the Query Editor in the Developer Console does not recognize it.
    – Jagular
    Commented Aug 7, 2014 at 20:29
  • I was referring to the eclipse salesforce schema browser, but yes I do see it in the object field listing, but not when you open the object in the developer console.
    – Jenny B
    Commented Aug 7, 2014 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .