简体   繁体   中英

Bulk delete inactive bins

I am trying to bulk delete all the inactivated bins in the system. I did not see any such option under mass updates or using saved search inline editing. Please advise if there is another option to achieve this as I have hundreds of such records to be deleted.

When wanting to perform mass deletions, you can create a script that works as a generic mass update script. Deploy this script against whichever record you want to delete (the Bin record in your case). Then use the built-in mass update process in NetSuite, Lists -> Mass Update -> Mass Updates -> Custom Updates -> Bin -> [your script] .

Although, it doesn't look like you can delete bins just because they're empty. It looks like they must be unused. Meaning you'll need to remove any reference to the bin from any item or transaction. The message I receive when trying to delete a bin is:

You may not delete this bin record because it is already in use. You must either remove all references to it in item records and transactions or make it inactive.

Here's an example mass delete script you can use if you still want to go this route. You could also use this to mark bins inactive rather than delete them.

/**
 * @NApiVersion 2.0
 * @NScriptType MassUpdateScript
 * @NModuleScope Public
 */
define(['N/log', 'N/record'], function(log, record) {
    function each(params) {
        var recordType = params.type;
        var recordId = params.id;

        record.delete({
            type: recordType,
            id: recordId
        });
    }

    return {
        each: each,
    };
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM