如何用Node.js的strong-soap提取Netsuite搜索结果的指定字段值?
从Netsuite搜索结果中提取指定值(Node.js + strong-soap)
我在Node.js中使用strong-soap工具获取Netsuite已保存搜索的结果,目前已成功拿到数据,但需要从中提取指定值。直接用console.log打印的结果结构如下:
[ { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } }, { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } }, { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } }, { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } }, { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } }, { '$attributes': { '$xsiType': [Object] }, basic: { entityId: [Object], customFieldList: [Object] } } ]
我需要的信息位于entityId和customFieldList对象中,展开后可知目标是entityId的searchValue,以及customFieldList下customField的searchValue,请问该如何访问这些对象以获取目标值?
可行代码示例
const searchRows = result.searchResult.searchRowList.searchRow; searchRows.forEach((row) => { const entityIdValue = row.basic.entityId.searchValue; const customFieldValue = row.basic.customFieldList.customField.searchValue; console.log(entityIdValue); console.log(customFieldValue); });
内容的提问来源于stack exchange,提问作者TheIronKing
相关产品推荐
相关产品推荐

