netsuite - 在 Suitscript 2.0 的 Suitelet 中使用 N/record
问题描述
我正在尝试使用 Suitelet 中的 n/record 模块加载记录,但出现以下错误:
org.mozilla.javascript.EcmaError: TypeError: Cannot read property "SALES_ORDER" from undefined
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define(['./form', 'N/record'],
function(form, record) {
function onRequest(context) {
if(context.request.method === 'GET'){
var ratingForm = form.build(context);
var customRec = record.load({
type: record.TYPE.SALES_ORDER,
id: 18
});
这在一个表单中,我想加载一条记录,并使用现有的 SALES_ORDER 记录预填充我可以使用的任何字段。
也许我需要以不同的方式解决这个问题?
解决方案
更新您record.load
的如下
var customRec = record.load({
type: record.Type.SALES_ORDER,
id: 18
});
您可以查看所有受支持的记录类型列表。
推荐阅读
- javascript - 为什么nodejs websocket服务器在关闭后挂起?
- c++ - 函数“wxString::ImplStr(char const*, wxMBConv const&)”中的 wxWidgets minimum.cpp 线性错误
- mongodb - 仅使用 Socket.io 连接创建 mongoDB 会话
- ruby-on-rails - 带有 Arel 的 Rails 范围,NOW() 迁移后返回给我 NULL
- java - java如何检查是否启用了CDI?
- python-3.x - Python If Int 在两个值之间给出不正确的结果
- regex - 匹配正则表达式的第一个和最后三个字符(包括重叠)
- android - 如何向 Mikepenz Material Drawer 添加标题
- curl - 从 crontab 调用时,Curl 上传失败并显示“NSS 错误 -5938”
- continuous-integration - 在 kubeflow 的 ContainerOp 中处理凭据