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

One-liner AJAX Toolkit : Truncate SObject records

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 ( is defined).
Note that it deletes only up to 200 records (deleteIds maximum is 200...).

You can use this snippet window or firebug.
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 ~
THAT is a thing of beauty. Simple, Elegant and to the point.