For Map/Reduce Scripts in 2.0, do we have to parse...
# suitescript
t
For Map/Reduce Scripts in 2.0, do we have to parse the context values that come in from the getInputData entry point? I have had to parse the record object in the map function because the NS API function result.getValue doesn’t seem to return any data at all
e
Yep
JSON.parse(context.value)
👍 1
t
Will the native NS methods continue to work on the object that we get back after parsing?
e
That’s a good question. I was looking through some of our scripts and could not find any where we are using native NS methods on the object we receive in the map stage. We typically try to pass a standard javascript object into the map stage. But I know you can return a saved search from getInputData. So, I’m not entirely sure…
b
the native methods wont work anymore, its a normal Object
👍 1
t
But if we don’t parse, the naive methods should still work correct? I have been trying without parsing and it seems like even a .getValue is not returning anything…
e
Take a look at this page in the help center. The value of context.value is always going to be a string. So, there won’t be any way that you can use native NetSuite methods on this value. /app/help/helpcenter.nl?fid=section_4483841695.html
t
Thank you!!!!