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
Sumantra Chowdhury 17Sumantra Chowdhury 17 

Bad Id for mass task delete

Hi!
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?
ClintLeeClintLee
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,

Clint