This topic contains 2 replies, has 0 voices, and was last updated by Jarod Tavares 7 years, 9 months ago.

  • Author
    Posts
  • #1246

    Jarod Tavares

    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.

  • #1247

    michoel

    From what I can make out of the documentation, it sounds like you would access files via

    Code:
    context.request.files.custom_file
    https://system.netsuite.com/app/help…314805947.html

  • #1248

    Jarod Tavares

    Thank you!

    It now works. I probably should have noticed the object type…

You must be logged in to reply to this topic.