You need to sign in to do that
Don't have an account?
WebNX
SOQL Relationship Query
Hello Everyone,
I am have problems querying User's Task by using the following formula below. I just want to view task that the user(s) may have for today, but I am getting a error message stating Invalid Type.
Select Id, Name, Email,
(Select Subject, ReminderDateTime From Task Where ReminderDateTime = TODAY)
From User
Can someone please help me with this problem? Thanks in advance.
Try this:
List<Task> tsk = [Select Subject, ReminderDateTime From Task Where ReminderDateTime = TODAY and OwnerId =: User.Id ];
where User.id is the Id of the user you want to retrive the tasks for.
Sorry Sidharth,
But that is not what I am looking for. I am looking to join the two queries into one using relationship querying with an inner and outer join. By using the user level join and then look at all the task for that user has in the inner join. What you post is correct but not for what I want. I don't want make two separate queries in my code just one; this way I won't go over the governor limits in salesforce. If you try this query search below it will give you all the accounts along with the contacts with the account.
Now, trying the same formula to try to get the user's task(s) it won't work, and I have no idea why? But thanks for your help!
How about ?
Select OwnerId,Owner.Name, Owner.Email,Subject, ReminderDateTime From Task Where ReminderDateTime = TODAY order by OwnerId
I dont believe you can do that sort of inner query with Tasks - they're a 'special' object.