我正在尝试构建一个JS文件,将其放在文件柜中,以引用我经常重建的最常用的函数。我已经能够通过将脚本放在文件柜中并使用@NAmdConfig来引用函数来访问它。但是,我不能访问这些脚本中的NetSuite模块。我删掉了示例中的大部分函数,但如果我可以将其返回到原始的Map/Reduce脚本,就足够了。我如何才能在访问NetSuite模块的同时拥有我最常用函数的第三方脚本?
/**
* @NApiVersion 2.1
* @NModuleScope public
*/
var MattsFunctions = {
dynamicTransactionSearch:
function (sentId) {
var thisRecord = record.load({
type: record.Type.SALES_ORDER,
id: sentId
})
return thisRecord.id
}
}
我也试过
/**
* @NApiVersion 2.1
* @NModuleScope public
*/
define(['N/search', 'N/record'],
(search, record) => {
var exports = {};
var MattsFunctions = {
dynamicTransactionSearch:
function (sentId) {
var thisRecord = record.load({
type: record.Type.SALES_ORDER,
id: sentId
})
return thisRecord.id
}
}
exports.MattsFunctions = MattsFunctions
return exports
})
发布于 2021-08-15 01:35:07
想明白了。当然,只需在调用的函数中传递模块即可!
https://stackoverflow.com/questions/68781431
复制相似问题