0

For example: I have cvs file with account object records . if i uploaded cvs file (in vf page need to create attachment button which takes cvs file and need to create uploadFile button which stores csv file records to account object in sales force! please help on this ..

Salesforce Visualforce page showing file input and upload button

  • 1
    welcome to SFSE hareesh. You'll find that folks at SFSE are most helpful when you demonstrate you have tried something and have then run into issues. We tend not to want to just write code for others – cropredy Dec 16 '14 at 17:24
  • If part of your solution requires you to parse the CSV in Apex, here is some code that handles all but embedded new lines. – Keith C Dec 16 '14 at 22:49
  • Do you want to create records from the data inside of the CSV or just take the CSV and add it as an attachment to the Account that is currently in context (assuming on the page)? – Peter Knolle Dec 17 '14 at 2:21
2
  1. Create an Iterator to parse through the CSV and populate an Account object
  2. Insert / upset the create account records.

You show me a bit of your code, I will show you a bit of mine. For now, I have put the same level of effort into the answer that you have into your question.......

Here is the code I have found to work the best, especially for larger CSV files:

http://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

  • I have issues reading a large csv file so tried opting for batch apex and followed the link developer.financialforce.com/customizations/… But I do't understand where is the split('\n') happening. Where is the actual file being passed Can you please help me with the same as I vbelieve you were able to get the batch apex file import – Tarun Dec 18 '14 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.