I am using SF Mobile SDK to do a SmartSync
. Because of that, i need to make sure that the results come down in one query.
I want to select data from Task
where one of the following is true:
OwnerId
is a particular user id (Update this means, regardless of presence ofWhat
on theTask
)What.Type = 'Account'
andAccount.OwnerId
is a particular user idWhat.Type = 'Account'
andAccount.Owner.ManagerId
is a particular user id
I can get the bottom two like so:
SELECT Id, Status, Subject FROM Task
WHERE
(What.Type = 'Account'
AND WhatId IN
(SELECT Id FROM Account WHERE Owner.Manager.Id = '<USERID>'
OR OwnerId = '<USERID>'))
However, trying to add an OR OwnerId = '<USERID>'
to this query results in the dreaded semi-joins error:
Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions.
Is there any way to make this work in a single SOQL?
Again, repeat, not APEX, and really need to avoid two queries.
AccountId
filter, but the semantics are slightly different.