+ Start a Discussion

Task Subquery

Is it possible to subquery tasks?  I'd like to pull accounts that do not have an open task.


This is what I have:


for(account a: [select id, Name, ownerid, lastactivitydate FROM ACCOUNT WHERE ID IN (SELECT ACCOUNTID FROM task WHERE STATUS != 'NOT STARTED') AND lastactivitydate <:lastedit AND type = 'Active Opportunity' AND LastModifiedDate <:lastedit and ownerID !=: userinfo.getuserid() and LASTACTIVITYDATE!= NULL ORDER BY LastActivityDate Desc limit 150]) {
accountlist.add(new aAccount(a));


I am throwing this error:

Compile Error: Entity 'task' is not supported for semi join inner selects at line 35 column 24


Is there another way to pull all accounts that do not have an open task?

This old post most likely have the same problem as you. Try checking it out: http://boards.developerforce.com/t5/General-Development/SOQL-Leads-with-Open-Tasks-query/td-p/112452

Developer for www.voicent.com
Voicent provides CRM, auto dialer, predictive dialer, reminder, and call center solution that is suitable for anyone in any level
Voicent strives to meet customer demands to integrate Voicent software with CRM of their choice.