Does anyone have any experience with `addCustomDat...
# suitescript
n
Does anyone have any experience with
addCustomDataSource
from the
N/render
module?
Copy code
.addCustomDataSource({
    format: render.DataSource.OBJECT,
    alias: "ITEMS",
    data: items
});
I'm trying to add an Object items and I keep getting the following error.
"UNSUPPORTED_DATA_FORMAT","message":"You have supplied an invalid value for data format: JSON: The content of elements must consist of well-formed character data or markup."
Slack Conversation
s
I think you still need to stringify the object.
c
you don't have to stringify it
e
Here's how I have it working:
Copy code
tmpl.addCustomDataSource({
  alias: "grants",
  format: render.DataSource.JSON,
  data: JSON.stringify(data)
});
I never found success with the
OBJECT
format
c
your items data object may be bad too i'd take a look and validate that
m
that’s my guess too. we use OBJECT pretty regularly without issue, but our use cases are shallow and relatively simple.
n
Thanks for the feedback everyone, I'll try the DataSource.JSON and double check my data object.