博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NetSuite SuiteScript 2.0 use DeferredDynamicRecord
阅读量:5244 次
发布时间:2019-06-14

本文共 1309 字,大约阅读时间需要 4 分钟。

Background 

There is a case when we add dynamic sublists to NetSuite Transaction, for user to put in data.

In server-side, how to read it in SuiteScript 2.0, NetSuite version 2017.1.0.70

I found we can't use scriptContext.newRecord.getSublistValue to read data in custom sublist.

and we can't use scriptContext.newRecord.sublists.custpage_receipts to read detail objects. 

How to resolve this?

Solution

In beforeSubmit we have native NetSuite parameter scriptContext,

when we saw scriptContext.newRecord it's a type of DeferredDynamicRecord.

I thought we can read the object details inside, I.e. scriptContext.newRecord.sublists.custpage_receipts

But actually since scriptContext.newRecord is a type of DeferredDynamicRecord, we can't read the data inside.

Try this:

var currentRecord = scriptContext.newRecord;var objCurRec = JSON.parse(JSON.stringify(currentRecord));var objSublists = objCurRec.sublists ? objCurRec.sublists : '';var objCustReceipts = objSublists.custpage_receipts ? objSublists.custpage_receipts : '';

Steps:

  1. JSON.stringify scriptContext.newRecord. (It became string)
  2. JSON.parse the strigified string. (Now it becomes native object)
  3. Now we can read data inside I.e. objCurRec.sublists.custpage_receipts

 

转载于:https://www.cnblogs.com/backuper/p/NetSuite_SuiteScript_2_DeferredDynamicRecord.html

你可能感兴趣的文章
windows2008中没有右键个性化
查看>>
用友二次开发之登陆界面
查看>>
FastDFS 分布式文件系统的安装与使用
查看>>
在Java中谈尾递归--尾递归和垃圾回收的比较(转载)
查看>>
大数据视频
查看>>
嵌入式操作系统VxWorks简介
查看>>
UOJ #122 【NOI2013】 树的计数
查看>>
鼠标移上,内容显示
查看>>
使用Oracle的存储过程批量插入数据
查看>>
uva11584
查看>>
libevent和libev (转)
查看>>
Java泛型中的类型擦除机制简单理解
查看>>
Maven设置snapshot无法在远程仓库下载的问题解决
查看>>
DataSet筛选数据然后添加到新的DataSet中引发的一系列血案
查看>>
Gulp和Webpack工具的区别
查看>>
new delete的内部实现代码
查看>>
什么是MVC框架?
查看>>
查询数据库内共有多少张表
查看>>
pandas_1
查看>>
题解 P1972 【[SDOI2009]HH的项链】
查看>>