So I'm having a bit of weirdness surrounding the standard Salesforce 'Task' object.

Some quick background: we have custom lookup field on the task object that points at a custom object we've created.

Long story short, I'm trying to do a query something like this (most fields cut out just for the sake of brevity):

[SELECT Name, (SELECT Type, FROM Sub_Tasks__r) FROM Custom_Object__c]

When it tries to run this query, however, I get this error:

No such column 'Type' on entity 'LookedUpFromActivity'

Now, the first thing I tried to do to troubleshoot this was take the subquery out into it's own query, to make sure that worked. At first, it didn't, but that was apparently because SysAdmins don't by default have access to the type field for some reason. I figure this should solve my problem, because I could now successfully do the basic task query.

Unfortunately, even after adding access to the type field I still can't run it as a subquery. It throws the same error. Is there some bizarre Salesforce restriction that doesn't let me query for the Type field on Tasks in a subquery? Or am I just missing something really dumb?

Side note: If I remove the Type field from the subquery, it works fine. It only seems to have a problem with that field.

  • Is it a custom field? Double check your API Name because if it is, it should end in __c.
    – Adrian Larson
    Feb 7, 2017 at 16:01
  • 1
    @AdrianLarson No, it's the standard Type field on the standard Task object. The only custom field we have on the task object is the lookup. And if I pull the sub query out and make it it's own query it works fine. The problem seems to only exist when querying that standard field through a subquery. Feb 7, 2017 at 16:08
  • 2
    I don't see Type field as mentioned by @AdrianLarson in LookedUpFromActivity object. Probably you could use ActivityType to identify the type.
    – Raul
    Feb 7, 2017 at 16:18
  • @RahulSharma So when used as a subquery, the fieldname changes? I guess this is caused by the whole Activity/Event/Task being the same object? Changing the field to ActivityType seems to let me run the query, I'll double check it's giving me the correct data as well. Feb 7, 2017 at 16:21
  • @RahulSharma Looks like a good answer. Dominator, notice that the object type itself changed from Task to LookedUpFromActivity. The SOAP API Developer Guide is your friend.
    – Adrian Larson
    Feb 7, 2017 at 16:28

1 Answer 1


If you look at LookedUpFromActivity object.

There is no Type field, instead you can use ActivityType or ActivitySubtype field

You must log in to answer this question.

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