/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
*
*/
define([ 'N/runtime', 'N/record', 'N/search'],
(runtime, record, search) => {
getInputData = () => {
log.debug('===START===');
const scriptObj = runtime.getCurrentScript();
const savedSearch = scriptObj.getParameter({name: 'custscript_saved_search'});
const searchObj = search.load({
id: savedSearch
});
return searchObj;
}
map = (context) => {
try {
const fieldLookUp = search.lookupFields({
type: 'transaction',
id: context.key,
columns: ['recordtype']
});
const transRecord = record.load({
type: fieldLookUp.recordtype,
id: context.key
});
transRecord.save({
enableSourcing : true,
ignoreMandatoryFields : true
});
}
catch(e) {
log.error('Error loading and saving', JSON.stringify(e));
}
}
summarize = (summary) => {
log.debug('===END===');
}
return {
getInputData: getInputData,
map: map,
summarize: summarize
};
});
Jaime Requena is a seasoned NetSuite Consultant and Solutions Architect, known for delivering WHITE GLOVE service to businesses. With 15+ years of experience and 3x certifications in ERP, Developer, and Admin, Jaime specializes in highly customized NetSuite accounts, transforming operations for 200+ satisfied customers all across the globe.
We aim to bring unmatched expertise and professionalism to your NetSuite initiatives. Let’s talk about how our NetSuite consultancy can make a difference!
It’s Been 4+ Years Now And We Have Worked With Hundreds Of Clients, Building Our Way To The Top, One Happy Client After Another! Their Voices Of Satisfaction Serve As A Testament To Our Success –