anybody have user the render.addCustomDataSource? ...
# suitescript
r
anybody have user the render.addCustomDataSource? I am adding an array of objects but when I run the script I get
You have supplied an invalid value for data format: JSON: A JSONObject text must begin with '{' at 1
. Tried using
render.DataSource.JSON
and
render.DataSource.OBJECT
but get the same error.
b
the error is suggesting that you need to pass in a object and not an array.
j
I've seen this before. That API doesn't think arrays are valid JSON, so you can just put the array as a property of an object and pass the object.
Copy code
// you have this
var array = [...];

// do this
var obj = { arr: array };
render.addCustomDataSource(... obj ...);