+ Start a Discussion

Deleting ids


Is there any way of deleting a collection of objects via their ids in Apex, e.g. delete(ids)?

The reason I'd like to do this is that I have a complex trigger which has to delete
> 10 different custom object types. The problem is that I keep hitting governor limits, which I guess
is due to using delete() on each object type.

To overcome this, I was hoping to be able to collect them all as a Set(<Id>) and
then mass delete them.

Ron HessRon Hess
I think you can just call delete with an array or list of ID's of any object. i have not tried this but it should work.

Would appreciate it if you could test this. I can a type invalid error when compiling it for delete(x)
where x is a set of <ID>.