Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
File upload suitelet
Ok, I am part way to creating a really rather cool suitelet that allows customers (who are logged in) to upload files and attach them directly to their entity record.
The code i am using is:
function uploader(request, response) { if (request.getMethod() == 'GET') { var form = nlapiCreateForm('Attach File to Customer', false); var entityField = form.addField('entity', 'select', 'Customer', 'customer'); entityField.setLayoutType('normal', 'startcol') entityField.setMandatory(true) var fileField = form.addField('file', 'file', 'Select File'); fileField.setMandatory(true) form.addSubmitButton(); form.addResetButton(); response.writePage(form); } else { var entity = request.getParameter("entity") var file = request.getFile("file") // set the folder where this file will be added. In this case, 10 is the internal ID // of the SuiteScripts folder in the file cabinet file.setName("file" + entity + ".jpg") //set file name file.setFolder(4) // now create file and upload it to the file cabinet. You must use nalpiSubmitFile 0