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
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!