The following script is deployed and runs correctly:
/**
* @NApiVersion 2.1
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define([],
function() {
const lineFieldLookup = [
'custcol_sas_adapter', 'custcol_sas_body', 'custcol_sas_box', 'custcol_sas_endcap',
'custcol_sas_lidcap', 'custcol_sas_mortrclr', 'custcol_sas_snout', 'custcol_sas_strmclr',
'custcol_sas_topclamp', 'custcol_sas_tplate'];
function validateLine(scriptContext) {
const fieldValuesTable = lineFieldLookup.map((fieldId) => {
return ({
fieldId: fieldId,
value: scriptContext.currentRecord.getCurrentSublistValue({sublistId:'item', fieldId: fieldId })
})
});
console.log(fieldValuesTable)
}
return {
validateLine: validateLine,
};
});
However, adding 'N/search' dependency to the script via browser 'edit' and clicking save throws an error.
Updated Code:
define(['N/search'],
function(search) {
// nothing changed here
}
The error:
Fail to evaluate script: {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"","stack":[]}
What's preventing me from being able to add the search dependency?