0

Very similar to my previous question here: Select all my tasks or tasks relating to my Accounts or Accounts of users i manage

Which seems to have been magically resolved by SF just somehow working.

I have a custom object, let's call it MySpecial__c.

That object like pretty much anything in SF has a OwnerId field.

Now, using SOQL from mobile SDK i want to query all MySpecial__c entries where i know the owner's manager's Id.

Something like:

SELECT Id, Name, OwnerId FROM MySpecial__c where Owner.ManagerId = '<UserId>'

Not unexpectedly, i get:

No such column 'ManagerId' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

I can't run this in 2 queries, really, due to how mobile SDK works (further fetches overwrite first fetches, and, additionally, we end up wasting API calls).

I tried doing sth magical like my original question, e.g.

SELECT Id, Name, OwnerId FROM MySpecial__c where User.Id IN ('<UserId>')

But that just gives me

Didn't understand relationship 'User' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

1 Answer 1

3

You should be able to use a join to your advantage here, I believe:

SELECT Name, OwnerId FROM MyObject__c WHERE OwnerId IN (
    SELECT Id FROM User WHERE ManagerId = 'someValue'
)

You must log in to answer this question.

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