probably something really simple but MRS : Referen...
# suitescript
n
probably something really simple but MRS : ReferenceError: search is not defined
b
usually means the search variable/parameter is undefined
share your code if you want greater confirmation
n
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
*/
define(['N/format', 'N/record', 'N/search'],
/**
* @param{format} FORMAT
* @param{record} RECORD
* @param{search} SEARCH
*/
function(FORMAT, RECORD, SEARCH) {
/**
* Marks the beginning of the Map/Reduce process and generates input data.
*
* @typedef {Object} ObjectRef
* @property {number} id - Internal ID of the record instance
* @property {string} type - Record type id
*
* @return {Array|Object|Search|RecordRef} inputSummary
* @since 2015.1
*/
function getInputData() {
//Search to get unique Currency with date
let search_celigo_amzio_sett_fee = SEARCH.create({
type: "customrecord_celigo_amzio_sett_fee",
filters: [
["formuladate: last_day(add_months({custrecordhb_amz_fee_posted_date}, 0))", "onorafter", "2020-02-01"]
],
columns: [
search.createColumn({
name: "formuladate",
summary: "GROUP",
formula: "last_day(add_months({custrecordhb_amz_fee_posted_date}, 0))",
sort: search.Sort.ASC,
label: "Posted Day"
}),
search.createColumn({
name: "custrecordrsm_marketplace_cus_tran_settl",
join: "CUSTRECORD_CELIGO_AMZIO_SET_F_PAR_TRANS",
summary: "GROUP",
label: "Marketplace"
}),
search.createColumn({
name: "custrecordhb_fee_currency",
summary: "GROUP",
label: "Currency"
})
]
});
return search_celigo_amzio_sett_fee;
}
/**
* Executes when the map entry point is triggered and applies to each key/value pair.
*
* @param {MapSummary} context - Data collection containing the key/value pairs to process through the map stage
* @since 2015.1
*/
function map(context) {
b
javscript is case sensitive
search
is not the same as
SEARCH
n
gotcha
thanks!