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.
__c
.ActivityType
to identify the type.Task
toLookedUpFromActivity
. The SOAP API Developer Guide is your friend.