Skip to content

Instantly share code, notes, and snippets.

@codebykyle
Created March 22, 2022 14:48
Show Gist options
  • Save codebykyle/f80d02ea2b16075c656fe533cd9831dd to your computer and use it in GitHub Desktop.
Save codebykyle/f80d02ea2b16075c656fe533cd9831dd to your computer and use it in GitHub Desktop.
Quickbooks Online bulk delete transactions
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function deleteTopTransaction() {
$('.dgrid-row')[0].click();
await sleep(250);
$('[data-automation-id="button-delete"]').click();
await sleep(250);
$('#yesNoDialog .button')[1].click();
}
async function bulkDelete(num) {
for (let i = 0; i < num; i++) {
await deleteTopTransaction();
await sleep(1000);
}
}
async function clearFilters() {
$('.entry')[0].click();
await sleep(1000);
}
async function run() {
await bulkDelete($('.dgrid-row').length);
await clearFilters();
}
run();
@codebykyle
Copy link
Author

codebykyle commented Mar 22, 2022

My bank was recently acquired and merged into another bank.

My personal instance had two bank integrations going, and some over zealous auto-reconciliation rules. This lead to some duplicated transactions in two accounts. The old bank's account needed to be rolled back. When trying to roll back transactions, you'll find that you have to handle it a single transaction at a time. I needed to bulk delete all transactions which happened after a specific date, which turned out to be a lot of clicking. Each transaction has a pop-up asking you if you're sure, and you can only delete one transaction at a time.

I setup a filter in the account transactions, for example, all transactions from 2021-06-05 forward, then paste this in the console. It will automate all the required clicks, and then clear the filters for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment