Sample Mass update for item fulfilment status

Mass update script

/**
 /**
 * @NApiVersion 2.1
 * @NScriptType MassUpdateScript
 */
/**
 * update the status of the itemfulfillment
 */
define(['N/runtime',"N/record"],
    
    (runtime,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) => {

          let funcName = "UpdateItemShipStatus  " + params.type + " " + params.id;
          let param_strShipStatus = 'C';
          try {
            record.submitFields({
              type : params.type,
              id : params.id,
              values : {
                'shipstatus' : param_strShipStatus
                /*
                     Use value such as 'A', 'B' or 'C'
                     Item Fulfillment:Picked               ItemShip:A
                     Item Fulfillment:Packed               ItemShip:B
                     Item Fulfillment:Shipped       ItemShip:C
              */
              }
            });

          } catch (ex) {
            log.debug(funcName + ', Error: ', JSON.stringify(ex));
          }
          return true;
        }
        return {each}

    });

XML – Script record

<massupdatescript scriptid="customscript_sample_massupdate">
<description></description>
<isinactive>F</isinactive>
<name>Sample MassUpdate</name>
<notifyadmins>F</notifyadmins>
<notifyemails></notifyemails>
<notifyowner>T</notifyowner>
<notifyuser>F</notifyuser>
<scriptfile>[/SuiteScripts/Sample Script/Sample - MassUpdateScript.js]</scriptfile>
<scriptcustomfields>
<scriptcustomfield scriptid="custscript_shipstatus">
<accesslevel>2</accesslevel>
<applyformatting>F</applyformatting>
<checkspelling>F</checkspelling>
<defaultchecked>F</defaultchecked>
<defaultselection></defaultselection>
<defaultvalue></defaultvalue>
<description></description>
<displayheight></displayheight>
<displaytype>NORMAL</displaytype>
<displaywidth></displaywidth>
<dynamicdefault></dynamicdefault>
<fieldtype>SELECT</fieldtype>
<help></help>
<isformula>F</isformula>
<ismandatory>F</ismandatory>
<label>new Status</label>
<linktext></linktext>
<maxlength></maxlength>
<maxvalue></maxvalue>
<minvalue></minvalue>
<onparentdelete>NO_ACTION</onparentdelete>
<searchlevel>2</searchlevel>
<selectrecordtype>-245</selectrecordtype>
<setting></setting>
<storevalue>T</storevalue>
</scriptcustomfield>
</scriptcustomfields>
<scriptdeployments>
<scriptdeployment scriptid="customdeploy_sample_massupdate">
<allemployees>F</allemployees>
<allpartners>F</allpartners>
<allroles>T</allroles>
<audslctrole></audslctrole>
<custscript_shipstatus>130</custscript_shipstatus>
<isdeployed>T</isdeployed>
<loglevel>DEBUG</loglevel>
<recordtype>ITEMFULFILLMENT</recordtype>
<runasrole></runasrole>
<status>RELEASED</status>
</scriptdeployment>
</scriptdeployments>
</massupdatescript>

Leave a comment

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