[SalesForce] SOQL Query To Return Any Open Tasks Assigned To a User

As the title suggests, I'm simply trying to return a list of open tasks for a particular user so I can mass-change owner using Dataloader.

I've worked my way to this query:

SELECT Id, AccountId, Account.Name
FROM Task
WHERE Account.Name = 'John Smith' AND isClosed = false

This is returning no records, however I have checked the users profile and they do have active tasks.

Interestingly, if I change the query to isClosed = true, it returns the list of completed tasks. However that is not what I need.

Furthermore, I've looked into Task fields and there is an "Assigned to" field that indicates to me that I am maybe using an incorrect WHERE clause in my query. Is there an easier identifier to get the name or Id of whoever owns the task?

Thanks in advance.

Best Answer

You are retrieving information about the related Account but that doe not mean the Owner of the Task matches the Account Name.

SELECT Id, AccountId, Account.Name
FROM Task
WHERE Owner.Name = 'John Smith'
AND isClosed = false

This query will return the Account information you need for any open Tasks assigned to 'John Smith'.