rcrd_dsnt_exist”,“消息”:;没有这种类型的记录
好的,大家,非常透过这杯上的玻璃杯。 非常感谢Barmar,Kryton和Bknights,他们的智慧帮助我这么远。
脚本已经改变,现在在下面。我可以将其上传并生成脚本记录,并且它确实尝试运行,但是现在我遇到了此错误:
“ type”:“ error.suitescripterror”,“ name”:“ rcrd_dsnt_exist”,“ message”:“: “没有这种类型的记录。”,“ stack”:[“ createError(n/error)”,“ initiateworkflow(/suitescripts/grn20.js:9)”],“原因”:{“ type”:'type“:”内部错误”,“代码”:“ RCRD_DSNT_EXIST”,“详细信息”:“没有此类型的记录。 InitiateWorkflow(/suitescripts/grn20.js:9)“],“ notifyOff”:false},“ id”:“”,“ notifyOff”:false,“ userfacing”:false} ,
但是记录确实存在,ID号和工作流ID如工作流中指定。
还有什么可能导致这个问题?
预先感谢您提出任何建议!
编辑 - 我被告知下面的记录ID应该参考项目的内部ID,这是没有意义的,我要启动的工作流程旨在更改多个项目的字段,为什么我需要在脚本中指定单个项目?
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/workflow', 'N/search', 'N/error', 'N/record'],
function (workflow, search, error, record) {
function initiateWorkflow(scriptContext) {
var workflowInstanceId = workflow.initiate({
recordType: 'inventoryitem',
recordId: 35,
workflowId: 'customworkflow14'
});
var inventoryitemRecord = record.load({
type: record.Type.INVENTORY_ITEM,
id: 35
});
}
return {
afterSubmit: initiateWorkflow
};
});
Okay everyone, very much through the looking glass on this one.
Many thanks to Barmar, Kryton and bknights whose wisdom has helped get me this far.
The script has changed and is now below. I can upload it and generate a script record and it does actually attempt to run, but now I am getting this error:
"type":"error.SuiteScriptError","name":"RCRD_DSNT_EXIST","message":"There are no records of this type.","stack":["createError(N/error)","initiateWorkflow(/SuiteScripts/grn20.js:9)"],"cause":{"type":"internal error","code":"RCRD_DSNT_EXIST","details":"There are no records of this type.","userEvent":"aftersubmit","stackTrace":["createError(N/error)","initiateWorkflow(/SuiteScripts/grn20.js:9)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false}
But the record definitely does exist, the ID number and workflow ID are as specified in the workflow.
What else could be causing this problem?
Thank you in advance for any suggestions!
Edit - I have been told that the record ID below should refer to the internal ID of the item, this makes no sense, the workflow I am trying to initiate is designed to change fields on multiple items, why would I need to specify a single item in the script?
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/workflow', 'N/search', 'N/error', 'N/record'],
function (workflow, search, error, record) {
function initiateWorkflow(scriptContext) {
var workflowInstanceId = workflow.initiate({
recordType: 'inventoryitem',
recordId: 35,
workflowId: 'customworkflow14'
});
var inventoryitemRecord = record.load({
type: record.Type.INVENTORY_ITEM,
id: 35
});
}
return {
afterSubmit: initiateWorkflow
};
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在做的事情有几件事。这确实是RTM的情况。
您可能只是试图锻炼API,因此并不真正关心NetSuite的类型,但NetSuite确实如此。它解析了NScriptType注释,并拒绝您的脚本不合格。
用户事件脚本具有类似的形状:
也是这些行:
看起来它们只是充满希望的猜测。如果您已登录NetSuite,所有这些都有在线帮助。
There are several things wrong with what you are doing. This really is a RTM situation.
You may be just trying to exercise the API so don't really care about the type of script but Netsuite does. It parses the NScriptType annotation and is rejecting your script as being non-conforming.
A user event script has a shape like:
Also these lines:
look like they are just hopeful guesses. There is online help for all of this if you are logged in to Netsuite.
我可以看到两个问题:
define()
而不是require()
。从下面的NetSuite文档发出的注释:返回
块中实现入口点功能。对于此类用户事件脚本,这意味着您需要beforeload
,beforeSubmit
或aftersubmit
。就您的示例而言,您的脚本最终会看起来像这样:
There are 2 issues that I can see:
define()
rather thanrequire()
. Note from NetSuite documents below:return
block. For a User Event Script as this is, that means you need one ofbeforeLoad
,beforeSubmit
orafterSubmit
.For your example, your script would end up looking something like this: