NetSuite – Deleting Records like a pro
Let’s be honest NetSuite is a great platform, it allows you to do anything you need to run your business successfully, no matter what industry you are; manufacturing, retailing, servicing etc NetSuite has your back. However, since NetSuite is a proprietary system, the limitations to access the database and some of the system resources are limited to whatever the system was designed to do, the SuiteScript API and SuiteCloud API.
Therefore, you will encounter that one of the shortfalls using NetSuite is the ability to delete records in bulk. So make sure that your CSV import jobs get tested correctly or you will be spending lots of time clicking, selecting rows and deleting (phew my finger hurts).
Yes, you have the option to delete records by hand; by selecting a cell that supports editing and pressing shift, you should be able to select the rows you want to delete; but this is not deleting records as a pro, this is more like deleting records as a user.
This post was created for all of those NetSuite implementers, administrators, users etc, that may require some help deleting those dozens, hundreds or perhaps thousand of unnecessary records. Here is how:
- Copy the bellow code into a text editor and save it as mass_del_rec.js
- Go to Customization > Scripting > Scripts > New
- Upload your script
- Select Mass Update
- Deploy your script
- Select the record you want to delete
- Assign the proper permissions
- Go to List > > Mass Update > Mass Updates > Custom Mass Updates
- Custom Updates > Find the name of the mass update you deployed
- Add a criteria as needed; date range, filter by customer etc
- Click Preview Update
- Verify the data you are deleting is the data you want to delete
- Click Perform Mass Update
- Done
I have seen this process deleting around two, three thousands of records in less than one hour and around ten thousand in three to five hours. It works pretty well.
function delRecord(recordType, recordID) { //record try { nlapiDeleteRecord(recordType, recordID); nlapiLogExecution('debug', 'Deleted ' + recordType + ' Record ID ' + recordID); } catch (ex) { nlapiLogExecution('error', 'Cant delete ' + recordID ' of type ' + recordType, ex.message); } }
I can’t tell you how many times this script has been helpful during an implementation, data migration or some other process, for me or a member of my team.
To delete more complex data like transaction and its related records, contact us.
0 Comments on "NetSuite – Deleting Records like a pro"