I am trying to build a data import using a csv and importing into accounts and contacts using a VF page.

I know we have the wizard and data loaders to specifically do this job. But the requirement is such that users are technically inept to handle data loaders. We just want them to provide the templated csv files with data in it and upload it.

What are things that we need to be aware of while building something like a data loader.

  1. How do we check if there are duplicates on Contact or account? which all fields need to checked for duplicates other than name?

  2. Are there anything else that i need to be aware of??


1 Answer 1


Duplicate criteria could vary from business to business, if you are not building an app-exchange app, this could be confirmed with relevant guys in the client's org. If the app is going to hit app exchange, then this duplication criteria / fields etc could be kept in custom settings, so that customers can tweak it.

Apart from that, I fear governor limits as a big challenge, things that you might need to consider, like:

  1. Heap size, if string (CSV) is too huge for normal apex runtime heap(6 MB) limit, remember other apex classes and structures will share the heap as well.
  2. "Total number of executed code statements" if you are looping and doing checks on each row, this limit could be easily touched.
  3. Plus other limits of describes / soqls fired etc, depending on your logic.

I am not getting into design as not sure about the end product, but splitting the CSV into chunk of rows and processing these chunks via Batch Apex etc could be something to consider if you are hitting too many limits. Again this depends, if your clients are fine with async interface from UX standpoint i.e. end users submit CSV:

  1. If chunk could be processed immediately, parse and show user next screen.
  2. Else tell user that you're processing the CSV and will notify when done. Here you can use batch apex etc to process the huge file and notify user's via PushTopics or email.
  • Thanks abhinav.. This is a non app exchange soln. To take care of the limits, the business requirement in itself is limiting the no of records to 1000 in the csv. I like the batch processing idea will put forward that idea if they really need more records to be entered
    – Prady
    May 20, 2013 at 10:47

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .