context.response.write gives me this error, writeP...
# suitescript
r
context.response.write gives me this error, writePage or write File downloads the file i want it to display on the new tab
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "WRONG_PARAMETER_TYPE",
  "message": "Wrong parameter type: output is expected as null. ",
  "stack": [
    "createError(N/error)",
    "renderTxt(/SuiteScripts/Denali_SL_CallPDF.js:50)",
    "createError(N/error)"
  ],
  "cause": {
    "name": "WRONG_PARAMETER_TYPE",
    "message": "Wrong parameter type: output is expected as null. "
  },
  "id": "",
  "notifyOff": false,
  "userFacing": true
}
b
go over the parameters of ServerResponse.writeFile
r
thanks bro!
w
You can also pass the context into the render TemplateRenderer.renderPdfToResponse()
r
okay, i am using client script for now to call the suitelet from the button created by user event... is it possible to directly call suitelet from Userevent ??
b
not really
user event scripts dont have the cookie required to access internal suitelets
and its dumb to make your suitelet external for this
r
well okay, i guess then UES-CL-SL is the only way
b
its easier to put the file generating code in a custom module and share between a user event script and suitelet
r
right
w
so the UE can make an ajax call to your suitelet if it is public; you can use the redirect module on before/after sub to take the user to the Suitelet
r
yeah is it worth to do this, rather than to make a Client script?
w
Possibly; it depends on what your users need.