NetSuite Records Deletion (Scripts)
9 min
netsuite record deletion – deployment guide this document provides clear, step by step instructions to deploy and use the netsuite record deletion in your netsuite account 1\ overview the record deletion tool is designed to safely delete netsuite records in bulk using a background process it consists of two scripts suitelet script – provides a user interface to select the subsidiary and record type map/reduce script – performs bulk deletion asynchronously in the background 2\ upload script files navigate to documents > files > suitescripts click add file and upload the following files https //drive google com/file/d/1mqwmdmljasu1kk3rktbkujxlksiaxngx/view?usp=sharing https //drive google com/file/d/1psym5pfrfk84ej0iurk3uizzpscyrzwy/view?usp=sharing 3\ create map/reduce script navigate to customization > scripting > scripts > new select the file del mapreduce js click create script record enter the following details name delete records map/reduce (or any preferred name) id delete1 (mandatory – used in script) add script parameters go to the parameters subtab parameter 1 label record type (or any preferred name) id recordtype (mandatory – used in script) type free form text parameter 2 label subsidiary (or any preferred name) id subsidiary (mandatory – used in script) type free form text parameter 3 label transaction date from (or any preferred name) id trandatefrom ( mandatory – used in script ) type free form text parameter 4 label transaction date to (or any preferred name) id trandateto ( mandatory – used in script ) type free form text parameter 5 label created date from (or any preferred name) id createddatefrom ( mandatory – used in script ) type free form text parameter 6 label created date to (or any preferred name) id createddateto ( mandatory – used in script ) type free form text click save important enter parameter ids without the custscript prefix netsuite will add it automatically 5\ deploy map/reduce script open the map/reduce script record click deploy script configure the deployment title delete records deployment (or any preferred title) id delete2 (mandatory – used in script) log level debug execute as role administrator (or appropriate role) click save 6\ create suitelet script navigate to customization > scripting > scripts > new select the file del suitelet js click create script record enter the following details name delete records suitelet (or any preferred name) id delete suitelet (or any preferred id) click save 7\ deploy suitelet script open the suitelet script record click deploy script configure the deployment title delete records ui (or any preferred title) id delete suitelet deploy (or any preferred id) log level debug status released execute as role administrator (or appropriate role) audience > roles administrator click save 8\ accessing and using the script open the suitelet deployment record copy the internal url or external url paste the url into your browser select a subsidiary select a record type — choose an individual type or a group option all records – deletes all supported record types (transactions + entities/items) all cust/vend/emp/item records – deletes all customers, vendors, employees, and items all transactions (incl jes) – deletes all transaction types (invoices, payments, credit memos, bills, checks, journal entries) or select an individual record type (customers, vendors, items, etc ) select a delete by date option all records – deletes all records for the selected subsidiary and record type without any date filtering transaction date range – filters by transaction date available for transaction types only (not available for customers, vendors, employees, or items) creation date range (default) – filters by record creation date available for all record types if using a date range option the to date is required the from date is optional — leave it blank to delete all records up to and including the to date a confirmation message will appear at the bottom showing exactly what will be deleted click delete records the map/reduce script runs in the background a progress bar is displayed while processing for group options, the progress page shows the current record type being processed (e g , "currently processing invoices") overall progress with status for each type (completed / processing / pending) each type is processed one by one in the correct dependency order (e g , payments before invoices, transactions before entities) once all types are done, the page updates to "all records deleted" a "completed" message is displayed once processing finishes 9\ supported record types the following record types are supported customers vendors employees items journal entries invoices customer payments credit memos vendor bills vendor payments vendor credits checks 10\ record selection criteria records are deleted based on the following filters subsidiary always required — matches the selected subsidiary delete by date all records no date filtering — deletes all records for the subsidiary and record type transaction date range filters by transaction date (available for transactions only) creation date range filters by record creation date (available for all record types) date range details only one date range is used at a time (selected via the delete by date dropdown) transaction date range is only available for transaction types (journal entries, invoices, customer payments, credit memos, vendor bills, vendor payments, vendor credits, checks) it is not available for customers, vendors, employees, or items group options (all records, all cust/vend/emp/item records, all transactions) follow the same date filtering rules as individual types — the available delete by date options depend on the record types included in the group the from date is optional — leave it blank to delete all records up to and including the to date all dates are inclusive — both the from and to dates are included in the deletion range 11\ troubleshooting the following ids are hardcoded and must match exactly map/reduce script required id delete1 final system id customscript delete1 map/reduce deployment required id delete2 final system id customdeploy delete2 parameter – record type required id recordtype final system id custscript recordtype parameter – subsidiary required id subsidiary final system id custscript subsidiary parameter – transaction date from required id trandatefrom final system id custscript trandatefrom parameter – transaction date to required id trandateto final system id custscript trandateto parameter – created date from required id createddatefrom final system id custscript createddatefrom parameter – created date to required id createddateto final system id custscript createddateto