cancel
Showing results for 
Search instead for 
Did you mean: 

JSONPath get element from NetSuite array

brianrandolph
New Contributor III

I have an array of custom fields (identified by @scriptId) and values returned from NetSuite. I’d like to select the value where the script id is equal to a particular name, for example, ‘custentity_topogname’. Can anyone shed some light on the subject?

jsonPath($, “$[‘listRel:customFieldList’][‘platformCore:customField’][*][‘@scriptId’]”)
returns the list of script ids:

“value”:
“custentity_esc_last_modified_date”,
“custentity_2663_direct_debit”,
“custentity_topogcompcode”,
“custentity_externalid”,
“custentity_topogname”,

jsonPath($, “$[‘listRel:customFieldList’][‘platformCore:customField’][*][‘platformCore:value’]”)
returns the list of values:

“value”:
“2018-04-08T21:00:00.000-07:00”,
“false”,
“ABLPIRS001”,
“001URSOPE1”,
“001URSOPE1”

This is as close as I’ve gotten, but it returns an empty set:
jsonPath($, “$[‘listRel:customFieldList’][‘platformCore:customField’][?(‘.@scriptId’==‘custentity_topogname’)][‘platformCore:value’]”)

1 REPLY 1

brianrandolph
New Contributor III

$[‘listRel:customFieldList’][‘platformCore:customField’].filter(x=>x[‘@scriptId’] == ‘custentity_topogcompcode’).map(x=>x[‘platformCore:value’])[0]

This snippet was provided by SnapLogic support.