jen
10/18/2023, 8:22 PMcom.netsuite.suitescript.scriptobject.ScriptNullObjectAdapter@3dee0079
? It’s happening on a summarize()
stage of a M/RJames Pak
10/18/2023, 8:36 PMmy?.object?.keys?.and?.stuff
if you're using a custom objectalien4u
10/18/2023, 8:37 PMerictgrubaugh
10/18/2023, 8:38 PMjen
10/18/2023, 9:57 PMjen
10/18/2023, 9:57 PMalien4u
10/18/2023, 9:59 PMjen
10/18/2023, 10:09 PMalien4u
10/18/2023, 10:13 PMjen
10/18/2023, 10:15 PMjen
10/18/2023, 10:15 PMjen
10/18/2023, 10:15 PMjen
10/18/2023, 10:16 PMjen
10/18/2023, 10:16 PMjen
10/18/2023, 10:16 PMerictgrubaugh
10/18/2023, 10:19 PMgetInputData
?ec
10/19/2023, 12:32 AMjen
10/19/2023, 4:15 PMfunction summarize(context) {
log.debug({title: 'summarize()', details: 'start'});
md_logging.i3Log('EXPORT SAVED SEARCHES', 'summarize() start', 99, null, null, true);
// Report errors.
context.reduceSummary.errors.iterator().each(function(key, value) {
log.debug({title: 'Error in REDUCE stage on key ' + key, details: JSON.parse(value).message});
});
let csv = 'ID,Internal ID,Title,Record Type,File ID,File Title' + "\n";
context.output.iterator().each(function(key, value) {
value = JSON.parse(value);
log.debug({title: 'summarize()', details: 'iterator adding row'});
md_logging.i3Log('EXPORT SAVED SEARCHES', 'summarize() iterator adding row', 99, null, null, true);
csv += value.id + ',"' + value.internalid + '",' + value.title + ',' + value.record_type_name + ',' + value.file_id + ',' + value.file_title + "\n";
return true;
});
// Make the CSV file.
let filename = 'saved_search_export_report_' + md_formatting.filetime() + '.csv';
let csv_file = file.create({
name: filename,
fileType: file.Type.CSV,
contents: csv
});
let subject = 'Map/Reduce: Export Saved Searches';
email.send({
author: NETSUITE_NOTIFICATIONS,
recipients: [12227],
subject: subject,
body: 'Please see attached<br/><br/>',
attachments: [csv_file]
});
}
jen
10/19/2023, 4:15 PMalien4u
10/19/2023, 4:17 PMalien4u
10/19/2023, 4:18 PMjen
10/19/2023, 4:18 PMjen
10/19/2023, 4:18 PM