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
JSBrianJSBrian 

Querying Tasks and User Table

I am trying to write a query to return any open tasks by all members who report under me.

select t.ownerid, t.createdbyid, t.description, 
(SELECT u.id from user u where direct_manager__c.id = 'myidgoeshere')
from task t
where t.isClosed = false

This - SELECT u.id from user u where direct_manager__c.id = 'myidgoeshere'  alone gets me all the id's for this people.  I think need to take that id and query the tasks.

I have been trying a variety syntax changes but can't seem to get it.  Any tips?

Thanks



Jon L. DaviesJon L. Davies

Give this a try.

 

Code:
Select t.CreatedById, t.Description, t.IsClosed, t.OwnerId from Task t  Where IsClosed=True and t.CreatedBy.Direct_Manager__c = 'YourIdGoesHere'