Last active
December 10, 2018 20:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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