Mass Update Script to remove the Payment Method from SO

Jira Code : BGGN-304

Description

The Mass update script will remove the payment method from the Sales order under some conditions.

Solution

/**
 /**
 * @NApiVersion 2.1
 * @NScriptType MassUpdateScript
 */
/*******************************************************************************
 * CLIENTNAME:Bloom & Grow Group-HK-NS
 * BGGN-304
 * Remove Payment Method from Sales Order
 *************************************************************************
 * Date : 15-07-2022
 *
 * Author: Jobin & Jismi IT Services LLP
 * Script Description :
 * The script will remove the payment method from the Sales order under some conditions.
 * Date created :15-07-2022
 * Created by: Aranya T R, Jobin & Jismi IT Services LLP
 * REVISION HISTORY
 * Revision 1.0 ${15-07-2022}
 *
 ******************************************************************************/

define(['N/record'],
    /**
 * @param{record} record
 */
    (record) => {
        /**
         * Defines the Mass Update trigger point.
         * @param {Object} params
         * @param {string} params.type - Record type of the record being processed
         * @param {number} params.id - ID of the record being processed
         * @since 2016.1
         */
        const each = (params) => {
            var soRec = record.load({
                type: params.type,
                id: params.id
            });
            var payment = soRec.setValue({
                fieldId : "paymentmethod",
                value   : ""
            });

            log.debug("Payment method", payment );
            soRec.save();

        }

        return {each}

    });

Leave a comment

Your email address will not be published. Required fields are marked *