+ Start a Discussion
Sumantra Chowdhury 17Sumantra Chowdhury 17 

Bad Id for mass task delete

I have a requirement to mass delete tasks for a user. However i am only presented with a single id at the mapping field. What do i need to do to make all the mapping fields available?
Hi Sumantra,

One way to do this in Apex is to delete the Tasks using a query.

Here is an example:
delete [select Id from Task where OwnerId = 'your_user_id' limit 10000];
Note that DML statements are limited to 10000 records.  If your query exceeds 10000 records it will throw a DMLException, hence the "limit" statement in the query.

Hope that helps,