我正在尝试以下面的格式访问json数据...
{"subscriptions":
"recmachcustrecord2": [{
"custrecord_acceptable_min_shelf_life": "60",
"custrecord_item": {
"internalid": "399",
"name": "ABS2002-PACK"
}
}, {
"custrecord_acceptable_min_shelf_life": "60",
"custrecord_item": {
"internalid": "400",
"name": "ABS2003-PACK"
}
}]
}
我写得像
var subrec = salesRepRec.getSublistSubrecord({
sublistId:'recmachcustrecord2',
fieldId:'custrecord_item',
行:0
});
{"type":"error.SuiteScriptError","name":"FIELD_1_IS_NOT_A_SUBRECORD_FIELD","message":"Field custrecord_item is not a subrecord field.","stack":["anonymous(N/serverRecordService)","onAfterSubmit(/SuiteScripts/cus.js:23)"],"cause":{"type":"internal error","code":"FIELD_1_IS_NOT_A_SUBRECORD_FIELD","details":"Field custrecord_item is not a subrecord field.","userEvent":"aftersubmit","stackTrace":["anonymous(N/serverRecordService)","onAfterSubmit(/SuiteScripts/cus.js:23)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false}
主要是我想访问"internalid": "400",
"name": "ABS2003-PACK"
这些字段。
如何使用套件脚本2.0访问
预先感谢!
答案 0 :(得分:0)
AFAIK NetSuite不允许创建自定义子列表子记录。尽管在这种情况下,您只需要从子记录中获取内部ID 和 itemid ,即可通过以下方式实现
{
custrecord_item: {
internalId: salesRepRec.getSublistValue({ sublistId: 'recmachcustrecord2', fieldId: 'custrecord_item', line: 0 }),
name: salesRepRec.getSublistText({ sublistId: 'recmachcustrecord2', fieldId: 'custrecord_item', line: 0 })
}
}