+ Start a Discussion
ShinShin 

One-liner AJAX Toolkit : Truncate SObject records


Code:
with(sforce.connection)deleteIds(query("SELECT Id FROM "+sobjectType).getArray('records').map(function(r){return r.Id}))

 

This should work in Firefox 1.5 + and IE7.
IE6 with prototype.js is also OK (Array.prototype.map is defined).
Note that it deletes only up to 200 records (deleteIds maximum is 200...).

You can use this snippet sforce.debug.open() window or firebug.
sfdcfoxsfdcfox
Nicely done. If you wrap that in a while loop, you could easily get the script to delete all records in the system (which is somtimes useful).

~ sfdcfox ~
MerrillMerrill
THAT is a thing of beauty. Simple, Elegant and to the point.

Thanks!