You need to sign in to do that
Don't have an account?
Bill Mc
Query Task Object from case
Hello. I am attempting to query Task Objects using the WhatId from a list of Case objects.
I know these Cases have Tasks because if I use the case Id instead of the List<> notation (":cs" below) in the query it works fine.
But for some reason "Select Id from Task where WhatId IN :cs]" does not work
Can anyon help? Code is below.
from Case where Subject='Thank you for contacting'
And AccountId=null And ContactId=null and Status='New' order by Createddate asc LIMIT 10]);
if(cs.size()>0)
{
List<Task> ts = new List<Task>([Select Id from Task where WhatId IN :cs]);
/* WHY DOES THE ABOVE RETURN 0 ROWS?? */
}
I know these Cases have Tasks because if I use the case Id instead of the List<> notation (":cs" below) in the query it works fine.
But for some reason "Select Id from Task where WhatId IN :cs]" does not work
Can anyon help? Code is below.
from Case where Subject='Thank you for contacting'
And AccountId=null And ContactId=null and Status='New' order by Createddate asc LIMIT 10]);
if(cs.size()>0)
{
List<Task> ts = new List<Task>([Select Id from Task where WhatId IN :cs]);
/* WHY DOES THE ABOVE RETURN 0 ROWS?? */
}
Bill Mc
Hello. Thanks for your mail.
You can partially see the code where values are added to cs list. The full line of code is:
List cs = new List([Select Id
from Case where Subject='Thank you for contacting Whizz Education!'
And AccountId=null And ContactId=null and Status='New' order by Createddate asc LIMIT 10]);
I also tried to use a List in the query but that also returned zero rows.
Any ideas?
Bill