You need to sign in to do that
Don't have an account?
Brooks Johnson 6
Query for Contacts Without Tasks
Hi Friends,
I have a requirement to find all contacts with no related tasks or if they do have a task to filter out certain types. When I start with a base SOQL Query on the workbench I get an error that Task is not supported from Semi Join inner select. The base query is:
SELECT Id, Name FROM Contact WHERE Id NOT IN (SELECT WhoID FROM Task). Is there another way to do this?
I have a requirement to find all contacts with no related tasks or if they do have a task to filter out certain types. When I start with a base SOQL Query on the workbench I get an error that Task is not supported from Semi Join inner select. The base query is:
SELECT Id, Name FROM Contact WHERE Id NOT IN (SELECT WhoID FROM Task). Is there another way to do this?
Hi,
You can try generating report from Accounts and contacts as below
Just use a Contacts & Accounts report where theLast Activity is blank
Best Regards,
Sandhya
There is no pure "declarative" solution (rollup summary field) or with a simple SOQL request for your problem.
That is a problem that you can "solve" with only a report as stated above but it is an incomplete solution (Activity is a task, an event or a calendar).
The only common solution is an Apex trigger (on insert, upate if conditions, and delete, +1/-1 on a counter) because even a standard rollup summary field is not possible here. The declarative processes and flows cannot manage the deletions.
The workaround to the standard rollup summary is a declarative rollup summary that is in fact a generator of trigger.
A Declarative Rollup Summary Tool for Force.com Lookup Relationships
https://developer.salesforce.com/blogs/2018/07/a-declarative-rollup-summary-tool-for-force-com-lookup-relationships.html
It is one of the only free tool of high quality but you need some work for the installation and the creation of your first declarative rollup summary.
This basic need has even a commercial package:
https://appexchange.salesforce.com/appxListingDetail?listingId=a0N30000000qCpCEAU