Store a file on the customer dashboard
# ask-stanley-ai
a
Store a file on the customer dashboard
c
AI generated answer (using internal Slack threads):
To store a file on the customer dashboard, you can use a Suitelet with a file upload field. This Suitelet can be deployed to the Customer Center. Here's a basic example of how you can create a Suitelet with a file upload field:
Copy code
javascript
function suitelet(request, response){
    if (request.getMethod() == 'GET'){
        var form = nlapiCreateForm('Upload Form');
        form.addField('custpage_file', 'file', 'Select a file');
        form.addSubmitButton('Upload');
        response.writePage(form);
    } else {
        var file = request.getFile('custpage_file');
        file.setFolder(-15); // Set the internal ID of the folder where you want to save the file
        var fileId = nlapiSubmitFile(file);
        response.write('File uploaded successfully. File ID is: ' + fileId);
    }
}
This Suitelet will create a form with a file upload field when accessed via a GET request. When the form is submitted (via a POST request), it will get the file from the request, set the folder where the file should be saved, and then save the file to the File Cabinet. For the file to be downloaded on your computer via the browser, you can use the
context.response.writeFile({file: pdf});
method. If you want to attach a single document to all customer records, you can use a CSV import to set that file on the existing customers. To have it attached in the future, just set a default value on the field. If all you really want is a link to the same file no matter what, set it as a non-store field and it will be whatever you set in the default value. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808915436
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.797767222
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794258714
Please provide your feedback on this answer.