+ Start a Discussion
Sitarama MurthySitarama Murthy 

CSV file upload from Vf Page

Hi All,

I have Requirement Where we have junction object ABC__c linked to Account and Campaign Objects. i created button in ABC__c object related list button which will open vf  page containing option to upload the csv file. insert part is wokring fine, that i can create new records from that button file import.

Problem is When user try to import new file with records having accounts which are already in that ABC__c object i need to update the existing records rather then creating duplicate records.(Current functionality is creating duplicate records which is wrong).

Can some one help me how can i check the csv file rows if that record is already present. if present i need to update that record.
i need to compare Account__ID__c field in the record in csv file with existing records Account_ID__c field in ABC__c object.

Over all project is to Add Accounts as campaign members
Thanks,
Ram
Raj VakatiRaj Vakati
If you want to prevent duplicate data .. you could do it based on the unique details like Name or Email or any external Ids .. 

if you can share the code and what is the unique filed to check the duplicate i am able to rewrite it for you