I am struggling with a bit of code that uses rende...
# suitescript
d
I am struggling with a bit of code that uses render… I am trying to pass in custom variables either basic strings or objects and I keep receiving the following error:
Copy code
"type":"error.SuiteScriptError","name":"UNSUPPORTED_DATA_FORMAT","message":"You have supplied an invalid value for data format: JSON: A JSONObject text must begin with '{'
Here is my code:
Copy code
renderer.addCustomDataSource({
        format: render.DataSource.OBJECT,
        alias: 'message',
        data: JSON.stringify(message)
      });
I have tried using render.DataSource.OBJECT and render.DataSource.JSON
I have tried the same above options passing just the object itself with and without JSON.stringify
all cases I have received the same error
d
Try data : message rather than data : JSON.stringify(message)
d
sorry but I don’t understand
@DMS oooh I understand I have already tried this but will be more than happy to try it again
d
JSON.stringify(message) converts the message object to a string
So in the code above you are passing a string rather than a JSON object
d
the values can be a string
I guess that is the potential problem
ok I must be a dolt
I got this working… doesn’t the render product HTML also?