javascript - 从配置文件脚本 (SuiteScript) 访问 NetSuite 模块
问题描述
我正在尝试构建一个 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
})
解决方案
弄清楚了。当然,只需在您正在调用的函数中传递模块!
推荐阅读
- c# - 如何读取在线存储的json文件并在找到时将图像更改为url
- ubuntu-16.04 - 如何为在 ubuntu xenial 上运行的花园容器配置 cgroup cpu 配额
- amazon-web-services - 无法在 Terraform ECS 提供程序中使用 memoryReservation
- java - android应用程序中的可拖动浮动窗口:不关注布局元素
- javascript - 为什么数组在快递中复制自己?
- pycharm - 在 PyCharm 中启用未解决的属性检查
- jboss - 内存泄漏 org.jboss.vfs.spi.JavaZipFileSystem 1582384
- elasticsearch - 根据上次索引时间在查询时间提升 Elastic Search 结果
- asp.net-core - ASP.NET Core 中没有匹配控制器或操作的路由段
- javascript - 登录javascript后在首页显示用户名