Options

Bulk deleting invoices

abangpurinta9abangpurinta9 Member Posts: 1

hi morning , i want to delete all of my invoice in my wave account . can you show me how the fast way to delete it ? because it will take a long time if i delete it manually one by one.
thank you

Comments

  • Options
    AlexLAlexL Member Posts: 2,869 ✭✭✭

    Hi @abangpurinta9 . We currently don't have a method to bulk delete invoices, so you do have to select Delete from the drop-down arrow menu beside the invoice line item.

  • Options
    brannettbrannett Member Posts: 8

    I managed to find a workaround using a 3rd party plugin

    (I was restricted by using a chromebook...therefore looked only at chrome browser extension. Perhaps there are better Macro recorder solutions available on Windows or Mac.)

    However - the following plugin saved me a ton of clicking and deleted all my recurring invoices that had been resulted in over a 1000 zero amount invoices....yet were clogging up my general ledger...as they showed as unpaid. The free version of the app can loop the macro 100 times and it took a little under 1 hour to process the 100.

    I installed iMacros for Chrome Offered by: iMacros (An Ipswitch Product)

    See the macro text below and also a screenshot of the settings I got to work.

    I found it sometimes stopped mid batch...but easily restarted by a single click. More likely to succeed if you logged out and in after each batch of 100....returning to the invoice page before running the macro loop again.

    Best of luck,

    Brendan

    MACRO :

    VERSION BUILD=1005 RECORDER=CR
    URL GOTO=https://next.waveapps.com/your unique id number/invoices
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV>NAV>UL>LI:nth-of-type(2)>DIV>UL>LI:nth-of-type(2)>A" BUTTON=0
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(4)>DIV>UL>LI:nth-of-type(3)>SPAN" BUTTON=0
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(4)>DIV>SPAN>DIV>TABLE>TBODY>TR>TD:nth-of-type(4)>A>SPAN" BUTTON=0
    EVENT TYPE=KEYDOWN SELECTOR="HTML>BODY" KEY=9
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>DIV>DIV>DIV:nth-of-type(4)>BUTTON" KEY=9
    EVENT TYPE=KEYDOWN SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>DIV>DIV>DIV:nth-of-type(4)>BUTTON" KEY=13
    EVENT TYPE=KEYPRESS SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>DIV>DIV>DIV:nth-of-type(4)>BUTTON" CHAR="\r"
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>DIV>DIV>DIV:nth-of-type(4)>BUTTON" BUTTON=0
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>DIV>DIV>DIV:nth-of-type(4)>BUTTON" KEY=13
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN>DIV>UL>LI:nth-of-type(11)>A" BUTTON=0
    EVENT TYPE=KEYDOWN SELECTOR="HTML>BODY" KEY=9
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN:nth-of-type(2)>BUTTON" KEY=9
    EVENT TYPE=KEYDOWN SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>SPAN:nth-of-type(2)>BUTTON" KEY=9
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>BUTTON" KEY=9
    EVENT TYPE=KEYDOWN SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>BUTTON" KEY=9
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON" KEY=9
    EVENT TYPE=KEYDOWN SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON" KEY=9
    EVENT TYPE=KEYUP SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON:nth-of-type(2)" KEY=9
    EVENT TYPE=KEYDOWN SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON:nth-of-type(2)" KEY=13
    EVENT TYPE=KEYPRESS SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON:nth-of-type(2)" CHAR="\r"
    EVENT TYPE=CLICK SELECTOR="#Content>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>BUTTON:nth-of-type(2)" BUTTON=0
    EVENT TYPE=KEYUP SELECTOR="HTML>BODY" KEY=13

    Settings :
    Ticks for only the following....all other options empty.
    Dock iMacros Panel to browser window
    Event recording mode (More Info)
    Use element ids whenever possible

    I also kept speed as normal - I had issues at the faster speed.

    edited April 21, 2020
  • Options
    ConnorMConnorM Member Posts: 1,229 ✭✭✭

    @brannett Brendan this is some really cool stuff! Thanks for sharing!

  • Options
    Nate_SimonsenNate_Simonsen Member Posts: 2

    Hello, there is an eaiser way to delete invoices with the wave api

    if you use the api, you can use a graphql mutation to delete invoices 50 at a time

    here is an example python script to do the job

    import requests
    import json
    import sys
    import time
    import os
    from dotenv import load_dotenv
    
    load_dotenv()
    test_business_id = os.getenv('BUSINESS_ID')
    test_api_key = os.getenv('API_KEY')
    
    query = """
        query($id: ID!) {
            business(id: $id) {
                invoices(pageSize: 50) {
                    edges {
                        node {
                            id
                        }
                    }
                }
            }
        }
    """
    
    mutation = """
        mutation($input: InvoiceDeleteInput!) {
            invoiceDelete(input: $input) {
                didSucceed
            }
        }
    """
    
    # Load env variables
    load_dotenv()
    
    url = 'https://gql.waveapps.com/graphql/public'
    # make the graphql query
    r = requests.post(
        url,
        json={
            'query': query,
            'variables': {
                'id': test_business_id,
                'pageSize': 400
            },
        },
        headers={
            'content-type': 'application/json',
            'Authorization': 'Bearer ' + test_api_key
        }
    )
    
    
    json_data = json.loads(r.text)
    
    invoices_to_delete = [data['node']['id']
                             for data in json_data['data']['business']['invoices']['edges']]
    
    user_input = input(
        'WARNING: will delete invoices forever, are you sure (y/n): ')
    for invoice_to_delete in invoices_to_delete:
        if user_input == 'n':
            sys.exit()
        elif user_input == 'y':
            r = requests.post(
                url,
                json={
                    'query': mutation,
                    'variables': {
                        'input': {
                            'invoiceId': invoice_to_delete
                        }
                    },
                },
                headers={
                    'content-type': 'application/json',
                    'Authorization': 'Bearer ' + test_api_key
                }
            )
            json_data = json.loads(r.text)
            if json_data['data']['invoiceDelete']['didSucceed']:
                print('Invoice deleted Successfully')
    print('finished')
    
    

    whereas brennant's script is pretty awesome, he admitted that it took an hour, which may not be ideal....

    this script will delete invoices in batches of 50 in about 15-30 seconds, which a drastic improvement as far as speed goes
    hope this helps!

    edited January 8, 2021
Sign In or Register to comment.