Hi, I am trying to run mass update script on one of our custom records as below
/**
*@NApiVersion 2.x
*@NScriptType MassUpdateScript
*/
define(['N/record', ‘N/format'],
function (record) {
function each(params) {
// Need to LOAD each record and SAVE it for changes to take effect
// LOAD the SubItem
var ItemLoad = record.load({
type: params.type,
id:
params.id
});
var newDate="01/12/2022";
var parseDate = format.format({
value: newDate,
type: format.Type.DATE
});
ItemLoad.setValue('custrecordzab_si_start_date',parseDate);
ItemLoad.save()
}
return {
each: each
};
});
I receive an error for running this on one of the records as following:
org.mozilla.javascript.EcmaError: ReferenceError: "format" is not defined
when I debug the code, I found that it failes on format.format. I am not sure what am I missing, or what else I have to add for this in order to run.
I tried to swap the modules in the define section and it couldn’t find the record module when I run the script
thanks for any help in advance.