简体   繁体   English

批量删除非活动垃圾箱

[英]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).针对您要删除的任何记录(您的案例中的 Bin 记录)部署此脚本。 Then use the built-in mass update process in NetSuite, Lists -> Mass Update -> Mass Updates -> Custom Updates -> Bin -> [your script] .然后使用 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:尝试删除 bin 时收到的消息是:

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.如果您仍然想要 go 这条路线,可以使用以下示例批量删除脚本。 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,
    };
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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