I’m having issues with serverWidget.FieldType.FILE. I need to be able to submit a file with a form from a Suitelet, and I seem to be at a dead end. Has anyone else figured out how to do this in SuiteScript 2.0 yet? Any help is appreciated.
If I do this…
Code:
form.addField({
id: ‘custom_file’,
type: serverWidget.FieldType.FILE,
label: ‘File Upload’
});
…I get the expected file input, but upon submitting the form, context.request.parameters.custom_file is undefined. Of course, if I do this instead…
Code:
form.addField({
id: ‘custom_text’,
type: serverWidget.FieldType.TEXTAREA,
label: ‘Text Area’
});
…it works as expected, with context.request.parameters.custom_text containing the contents of the textarea.
Back in SuiteScript 1.0, there was nlobjRequest.getFile(id), which returned an nlobjFile object corresponding to the submitted file. Out of curiosity, I checked and found no such function or anything possibly similar among the properties of context.request in my SS 2.0 Suitelet. Checking the SuiteScript 1.0 to SuiteScript 2.0 API Map, there is no SuiteScript 2.0 API equivalent listed for nlobjRequest.getFile(id) either.
Thoughts?
This is a cached copy. Click here to see the original post.