You need to sign in to do that
Don't have an account?
How do I get only Accounts which have a specific Activity in their ActivityHistory
Hello,
Is there a way to find only those Accounts which have an Activity of a certain type in their ActivityHistory and exclude the ones that don't?
My current query looks like this:
SELECT Id, Name, ( SELECT Id, ActivityType, ActivityDate, Description, Status, Owner.Id, Owner.Name FROM ActivityHistories WHERE ActivityType = 'my_activity_type' ORDER BY
ActivityDate DESC ) FROM Account
What I want is only Accounts where ActivityHistories is not empty. e.g WHERE AccountHistories != null or so.
I know that I could just collect the Ids of the relevant accounts manually and do a second query. But since the number of Accounts in the system is > 40000 I'd rather get it all done in one step.
Thank you for your help!
According to the API documentation, ActivityHistory is not supported in a semi join subquery, so you will be forced to use 2 queries to process your data.
The following objects are not currently supported in subqueries:
All Answers
According to the API documentation, ActivityHistory is not supported in a semi join subquery, so you will be forced to use 2 queries to process your data.
The following objects are not currently supported in subqueries:
Thanks for your help!