Kmullervy
12/03/2020, 8:45 PMSandii
12/03/2020, 8:47 PMKmullervy
12/03/2020, 8:48 PMSandii
12/03/2020, 9:16 PM/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
* @author
*/
define([
'N/search'
], function (
search
) {
var exports = {};
exports.getInputData = function getInputData() {
return search.create({
type: search.Type.SAVED_SEARCH,
filters: [],
columns: ['id', 'name']
})
}
exports.map = function map(context) {
let values = JSON.parse(context.value).values; //custsearch_
search.load(values.id)._rawFilters
.forEach((filter) => {
if (filter.name === 'subsidiary') {
//do something with all these in reduce
context.write({
key: '1',
value: values.name
});
}
});
}
exports.reduce = function reduce(context) {
//do something with the array of searches found here
}
return exports;
});
something like that could be worth a shotSandii
12/03/2020, 9:17 PMKmullervy
12/03/2020, 9:18 PMSuitestallion
12/03/2020, 9:25 PMKmullervy
12/03/2020, 9:27 PMSuitestallion
12/03/2020, 9:28 PMKmullervy
12/03/2020, 10:02 PMPNJ
12/03/2020, 10:16 PMclass
Kmullervy
12/03/2020, 10:22 PMPNJ
12/04/2020, 9:05 AMSandii
12/04/2020, 3:27 PM