Prabhu
Prabhu

Reputation: 927

How to delete multiple contacts for the user in Netsuite?

I could delete multiple phone calls through Mass Updates. I can delete single contact,lead,customer...etc in UI and RESTlet code.

I want to delete multiple contacts,leads, customers, prospects, partners and vendors in UI and also using RESTlet code.

Upvotes: 0

Views: 1730

Answers (2)

Mike Robbins
Mike Robbins

Reputation: 3287

You can create a simple, custom mass update script that can be deployed to delete any record type using the Mass Update functionality. At the most basic, it would look like this:

function deleteRecord(recordType, recordId) {
    nlapiDeleteRecord(recordType, recordId);
}

Create a new Mass Update script and deploy the script to Contact records.

Then you can start a new mass update, select Custom Updates and you should see your custom mass update listed there. Then it works just like any other mass update. You build your query to select the records you want to delete, then click the Preview button, then click the Perform Update button.

When I deploy this script, I make sure that it's only available to the Administrator role and I usually leave it in Testing which makes it available only to me. It means I really need to be sure of what I'm doing before I use it.

Upvotes: 3

TonyH
TonyH

Reputation: 1181

Prabhu,

In javacript, either within a RESTlet or even client side, I'd build an array of items to delete, then iterating through with a for loop, call nlapiDeleteRecord.

If your lists contains items with children, it'll throw an error, so wrap the nlapiDeleteRecord with a try/catch block, so you can keep processing your list.

For those cases where records have children, you may need to build a special case or function to delete them too.

Upvotes: 0

Related Questions