Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ViktorMants/7fb262ebf345981c14cf2c21a8fa53f6 to your computer and use it in GitHub Desktop.
Save ViktorMants/7fb262ebf345981c14cf2c21a8fa53f6 to your computer and use it in GitHub Desktop.
This small hack will allow you to delete a large amount of data just by running it.
//guide:
//1) login to salesforce
//2) open dev tools console
//3) execute "pre-start script" in dev tools console
//4) in "useful script" replace ObjectApiName to your object name
//5) execute "useful script" in dev tools console
//pre-start script
document.write('<script src="/soap/ajax/44.0/connection.js" type="text/javascript"></script><script src="/soap/ajax/44.0/apex.js" type="text/javascript"></script>')
var __sfdcSessionId = document.cookie.split('; ').find((item) => {return item.indexOf('sid=') == 0}).substring(4)
//useful script
var callDeleteFunction = function(){
var records = sforce.connection.query('SELECT Id FROM ObjectApiName LIMIT 200')
var recIds = []
if (records.records) {
for (let rec of records.records) {
recIds.push(rec.Id);
}
sforce.connection.deleteIds(recIds,(result) => {console.log('ok');callDeleteFunction()})
}
}
callDeleteFunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment