function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC-NOOBSFDC-NOOB 

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?

cplusplus_pleasecplusplus_please
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.
Charleston ParapinskiCharleston Parapinski

Hi. Just answering in case someone came here now.
to subquery task in account do this:
SELECT id, (SELECT id FROM tasks) FROM account

Note the 's' at the end of 'task'

Charleston ParapinskiCharleston Parapinski
This documentation says about plural object name 
https://developer.salesforce.com/docs/atlas.en-us.236.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_query_using.htm