简体   繁体   English

NetSuite内的Restlet内如何使用脚本?

[英]How use suitscript inside Restlet inside NetSuite?

I am trying to create a restlet in which i can get the detail of a Field in Netsuite.I have tried the following code to get the details.When i run this Restlet by calling the external URL i get an error as: 我正在尝试创建一个Restlet,以便我可以在Netsuite中获取字段的详细信息。我尝试了以下代码来获取详细信息。当我通过调用外部URL运行此Restlet时,出现错误:

error code: UNEXPECTED_ERROR
error message:TypeError: Cannot call method "getType" of null (login.js$12762#16)

I am using following code 我正在使用以下代码

function getRESTlet(dataIn) {

    var field = nlapiGetField('custitem_cipp');   // specifiy the internalId of the field
        return field.getType();
}

Fields are only on the record, when your RESTlet executes, there is no record loaded. 字段仅在记录上,当您的RESTlet执行时,不会加载任何记录。 You need to load the item record then use nlobjRecord.getField 您需要加载项目记录,然后使用nlobjRecord.getField

从客户端脚本调用restlet时,使用客户端脚本获取记录ID并发送记录ID,可以使用id.getfieldvalue。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM