Selcuk Dogru
02/19/2020, 3:55 PMAshwin K.
02/20/2020, 11:35 PMSelcuk Dogru
02/21/2020, 6:51 AMSelcuk Dogru
02/21/2020, 4:00 PMSelcuk Dogru
02/21/2020, 4:01 PMSelcuk Dogru
02/21/2020, 4:01 PM{
"type": "error.SuiteScriptError",
"name": "SyntaxError",
"message": "Invalid quantifier ?",
"stack": [
"createError(N/error)"
],
"cause": {
"message": "Invalid quantifier ?",
"fileName": "/SuiteScripts/Generic Customizations/mr_file_test.js",
"lineNumber": 30,
"name": "SyntaxError",
"stack": "\tat /SuiteScripts/Generic Customizations/mr_file_test.js:30 (reduce)\n\tat INVOCATION_WRAPPER$sys:75\n\tat INVOCATION_WRAPPER$sys:23\n\tat INVOCATION_WRAPPER$sys:111\n\tat INVOCATION_WRAPPER$sys:4\n",
"rhinoException": "org.mozilla.javascript.EcmaError: SyntaxError: Invalid quantifier ? (/SuiteScripts/Generic Customizations/mr_file_test.js#30)"
},
"id": "",
"notifyOff": false,
"userFacing": true
}
Selcuk Dogru
02/21/2020, 4:02 PM/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType MapReduceScript
*
* @author Selcuk Dogru
*
* @module N/file
* @module N/task
*
* @description
*/
define(['N/file', 'N/task'],
function (file, task) {
function getInputData(inputContext) {
return [1];
}
function reduce(reduceContext) {
var fileObj = file.create({
name: 'cs_test1.txt',
fileType: file.Type.PLAINTEXT,
contents: 'whatever',
folder: 1836989
});
var fileId = fileObj.save();
file.delete({
id: fileId
});
}
function summarize(summary) {
summary.reduceSummary.errors.iterator().each(function (key, error) {
log.error('Reduce Error for key: ' + key, error);
return true;
});
var sTask = task.create({
taskType: task.TaskType.MAP_REDUCE,
scriptId: 'customscript1888',
deploymentId: 'customdeploy1'
});
sTask.submit();
}
return {
config: {
retryCount: 2,
exitOnError: false
},
getInputData: getInputData,
reduce: reduce,
summarize: summarize
};
});
Ashwin K.
02/21/2020, 4:41 PMSelcuk Dogru
02/21/2020, 5:19 PMSelcuk Dogru
02/21/2020, 5:20 PMSelcuk Dogru
02/21/2020, 5:20 PMSelcuk Dogru
02/21/2020, 5:24 PMSelcuk Dogru
02/21/2020, 5:27 PM