I'd like to pull all Opportunity IDs that have a task associated with a certain person.
I've tried the following
Select ID from Opportunity where AccountID IN (Select AccountID From TASK WHERE CreatedBy.Name='Person' OR LastModifiedBy.Name='Person' )
But I get the following error ERROR at Row:1:Column:80 Entity 'TASK' is not supported for semi join inner selects"
Is there any work around to this?
In just SOQL, I'm not sure if there is a way to do it. But if you're doing this as part of a trigger/class, you can do something like this:
List<Id> accountIds;
List<Task> tasks = [Select AccountID From TASK WHERE AccountId != null AND (CreatedBy.Name='Person' OR LastModifiedBy.Name='Person')];
for(Task task : tasks) {
accountIds.add(task.AccountId);
}
List<Opportunity> opportunities = [Select ID from Opportunity where AccountID IN :accountIds];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.