Forum Post: RE: Create a Batch Upload button in a portal

  • Thread starter Thread starter Godfrey Sorita
  • Start date Start date
Status
Not open for further replies.
G

Godfrey Sorita

Guest
Hi, There is a workaround for this. The first step is to create an object which will hold the CSV files. Then, create a new and view page of this object in your portal. The new page will act as an import page where the CSV file will be uploaded. Make sure to configure the page to redirect to the view page after the record has been saved. On the view page, paste the code below to a script component. This script reads the uploaded CSV file and creates records based on its content. script /* GLOBAL VARIABLES */ var curLine = 1; var content; $(document).ready(function() { $.ajax({ type: "GET", url: "{!file#url}", dataType: "text", success: function(data) { content = data; createRecords(); } }); }); function createRecords() { var lines = content.split(/\r\n|\n/); if (curLine lines.length) { cols = lines[curLine].split(','); fieldMap = []; fieldMap['firstName'] = cols[0], fieldMap['lastName'] = cols[1], fieldMap['middleName'] = cols[2]; rbf_createRecord("customer112", fieldMap, false, repeater); } } function repeater () { curLine++; createRecords(); } /script **Please change the field and object integration names in the script. Regards, Godfrey

Continue reading...
 
Status
Not open for further replies.
Back
Top