CodeMoto
CodeMoto

Reputation: 353

NetSuite Upload a File For A Record

Is there a way to allow a user to upload and attach a file to a record through online forms? I have a custom record type, Potential Resource, that I've created an online form for. The idea is that anyone can use the online form to create a Potential Resource record and upload a resume for that record.

Upvotes: 3

Views: 2281

Answers (2)

Rusty Shackles
Rusty Shackles

Reputation: 2840

By online form are you referring to a suitelet?

I believe you can do this via a suitelet, something like this

function imageUpload(request, response) {

    if (request.getMethod() === 'GET') {

        var form = nlapiCreateForm(formTitle);

        var file = form.addField('file1', 'file', 'Logo');
        file.setMandatory(true);

        form.addSubmitButton('SUBMIT');
     
        response.writePage(form);
    }
    else {
        var file = request.getFile('file1');
        
        // 133 is the id of the folder you want to save the file
        file.setFolder(133);
        file.setIsOnline(true);

        var id = nlapiSubmitFile(file);

    }
}

Upvotes: 1

felipechang
felipechang

Reputation: 924

I think there is a document type field:

Document
This lets you select a file cabinet document to preview or download. The field is searchable and can be added to search results.
Note: The user of the document custom field must have file cabinet access in order to view, select or upload documents.

You may have to play with the roles a bit.

Upvotes: 1

Related Questions