首页 文章

使用套件脚本从网络套件获取多个子列表

提问于
浏览
0

我正试图从客户网络套件中获取子列表

var lineCount = customer.getLineItemCount("subRec");

因为我得到了行数,有多子列表就好了

"subRec": [{
"days": "60",
"multisub1": {
    "internalid": "1",
    "name": "shell"
}

},{“days”:“60”,“multisub2”:{“internalid”:“400”,“name”:“shell2”}}]

它是子记录中的子列表,如上所述如何使用套件脚本访问 multisub1 记录 .

如何使用API从套件脚本访问此类型数据...

for getSubrecord()我得类似TypeError:在对象nlobjRecord中找不到函数getSubrecord . 我是net suite 1.0版本 .

提前致谢!

1 回答

  • 1

    要从子记录中获取子列表,首先需要获取子记录,然后更新其中的子列表 .

    subrecord = customerRecord.getSubrecord({ fieldId: SUBRECORD_FIELD_ID });
        // now read/set values from subrecord in the same way as you would from a record
    sublistLineCount = subrecord.getLineCount({ sublistId: SUBRECORD_SUBLIST_ID });
    var value = subrecord.getSublistValue({ sublistId: SUBRECORD_SUBLIST_ID, fieldId: SUBRECORD_SUBLIST_FIELD_ID, line: SUBRECORD_SUBLIST_LINE_NO });
    

    Note 您无需保存子记录 . 保存父记录后会自动保存 .

相关问题