You need to sign in to do that
Don't have an account?

Need to Delete the record on which I am operating
Hi All,
I would need help on a solution to delete the record on which I am operating.
Example : If I am inserting a record in Case object (Using triggers here) . Once the case is inserted I need to delete that.
Any thoughts ?
You can't delete the record that is being inserted any more - this used to be allowed but changed some time around winter 11 (from memory) an now throws an exception. Thus you either need to change the API version of the trigger to one that allows that change or carry out an asynchronous delete.
All Answers
You have a trigger, on case, and you want to delete the record that the trigger is executing on?
You can't delete the record that is being inserted any more - this used to be allowed but changed some time around winter 11 (from memory) an now throws an exception. Thus you either need to change the API version of the trigger to one that allows that change or carry out an asynchronous delete.
You could, but there are limits on how many of these you can fire in a 24 hour period - 200 per full Salesforce/ full Platform or Force.com One App license.
Another way would be to mark the record for deletion and then have some scheduled apex clean up on a regular basis.