Netsuite SuiteScript 2.0如何完成N/记录加载功能的参数 [英] Netsuite SuiteScript 2.0 How to complete the parameters of the N/record load function

查看:301
本文介绍了Netsuite SuiteScript 2.0如何完成N/记录加载功能的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调用Netsuite SuiteScript 2.0 N/record模块的加载函数,但是不确定如何传递参数.基本上,我想要一个与用户界面中当前记录具有相同ID(主键)的N/record,我可以用它循环遍历子列表项.

I am trying to call the Netsuite SuiteScript 2.0 N/record module's load function, but I am unsure as to what to pass for the parameters. Basically I would like a N/record with the same id (primary key) of the current record in the UI, that I can use to loop through the sublist items.

我不确定如何使用记录浏览器来查找正确的类型和ID.记录浏览器没有类型,所以我猜了名字.还有多个字段可能是主键ID.是tranid还是externalid还是其他字段?我对库存调整表特别感兴趣. externalid未定义,并且tranid将被生成.

I'm not sure how to use the Records Browser in order to find the correct type and id. The Records Browser does not have the type, so I guessed at the name. There are also multiple fields that could be the primary key id. Is it tranid or externalid or some other field? I'm specifically interested in the Inventory Adjustment form. externalid is undefined and tranid is To Be Generated.

是否可以通过这种方式基于currentRecord获取N/Record,或者是否也会遭受与currentRecord相同的问题(我不能使用selectLine来逐步浏览子列表)项,子列表项尚未保存,最后一项已部分完成)?

Is it possible to get a N/Record based on the currentRecord in this manner or will it also suffer from the same issues I have with currentRecord (I can't use selectLine to step through the sublist items, sublist items have not been saved yet and the last one is partially completed)?

/**
 * @NApiVersion 2.0
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(['N/search', 'N/record'], function (s, r) {
   function fieldChanged(context) {
      var currentRecord = context.currentRecord;
      var sublistName = context.sublistId;
      var sublistFieldName = context.fieldId;
      var currentLine = context.line;
      var recordId = currentRecord.getValue({fieldId: "externalid"});
      var record = r.load({
         type: r.Type.INVENTORY_ADJUSTMENT,
         id: recordId,
         isDynamic: true
      });

推荐答案

是否有可能基于currentRecord获得N/Record

Is it possible to get a N/Record based on the currentRecord

是的,尽管N/record模块用于加载/创建记录.因此,为了使用N/record模块,您需要确保记录已经存在或正在创建新记录.

Yes, although N/record module is used to load/create records. So in order to use N/record module, you need to make sure that your record already exists or you are creating new.

InternalId是需要作为type传递给record module的recordType.

InternalId specified at the top of the Records Browser page is the recordType that you need to pass as type to record module.

也请尝试使用异步版本的记录加载.即客户端脚本中的record.load.promise.

Also try using async version of record load. i.e record.load.promise in client script.

这篇关于Netsuite SuiteScript 2.0如何完成N/记录加载功能的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆