** be careful with this once the
records are deleted they are gone for good, if you have a sandbox or dev
account I would recommend trying it there first.
1. Take the following code paste it into notepad and save it as a .js file and upload the file into your NetSuite file
cabinet into the script folder.
function massDelete(rec_type, rec_id)
{
try {
nlapiDeleteRecord(rec_type, rec_id);
nlapiLogExecution ('DEBUG', rec_id + ' was deleted successfully');
}
catch(e) {
nlapiLogExecution ('DEBUG', rec_id + ' was not deleted\n' + e);
}
}
{
try {
nlapiDeleteRecord(rec_type, rec_id);
nlapiLogExecution ('DEBUG', rec_id + ' was deleted successfully');
}
catch(e) {
nlapiLogExecution ('DEBUG', rec_id + ' was not deleted\n' + e);
}
}
2. Create a new Script
3. select the Mass
Update
4. Select the
Script File that you uploaded in Step 1 and enter massDelete for the function
5. Click Save and Deploy
6. Select the
Document type that the deployment applies to and set the Status to “Released”
and the Execute as Role to “Administrator”
7. Save the Deployment
8. Create a new Mass
Update
9. You should find the
script deployment under Custom Updates
10. Open your mass update
and set the criteria. Select the criteria to limit which records you want to
delete.
11. Preview and run
your Mass Update
While using NetSuite SOAP APIs (2016_2) for Delete operation, it asks for script id, can you please explain how to get that.
ReplyDeleteNice sample, easy to use.
ReplyDeleteOne remark : black text on blue background is not easy to read. I copied and pasted the block in Word before using it.
Thanks for the tip anyway.