Discussions
NetSuite Admin Tip | Cleanup of Old Cancelled Sales Orders Using SuiteScript
Over time, NetSuite environments can accumulate a large number of old, cancelled Sales Orders. While retaining recent transactions may be required for compliance, many organizations choose to periodically purge records that are both cancelled and very old (e.g., 5+ years) to streamline reporting, reduce storage, and improve performance.
Using SuiteScript, this process can be automated—freeing admins from tedious manual review and deletion.
Example Script
The script below demonstrates how to delete Sales Orders with:
- Status: Cancelled (this is status code "SalesOrd:C")
- Created Date: On or before 5 years ago (calculated via "daysago1825").
/**
* @NApiVersion 2 .x
* @NScriptType ScheduledScript
*/
define(['N/search', 'N/record', 'N/log'], function(search, record, log) { Richard James Uri - SuiteCloud | WMS Tech | SuiteCommerce Advanced
----
- NetSuite Admin Corner | New to NetSuite
- Explore the NSC Webinars Category
- Join our poll and share your ideas! We want to know what you think. Don't forget to comment and make your voice heard!
