Mass Update Script Samples

Mass Update Script Sample

The following code updates the probability field of all existing records to 61%.

Note:

From the script deployment record, ensure that the Applies To field is set to Opportunity.

For help with writing scripts in SuiteScript 2.x, see SuiteScript 2.x Hello World and SuiteScript 2.x Entry Point Script Creation and Deployment.

          /**
 *@NApiVersion 2.1
 *@NScriptType MassUpdateScript
 */
define(['N/record'], (record) => {
    function each(params) {
        // Set the probability to 61%
        let recOpportunity = record.load({
            type: params.type,
            id: params.id
        });
        recOpportunity.setValue('probability', 61);
        recOpportunity.save();
    }
    return {
        each: each
    };
}); 

        

Related Topics:

General Notices