You need to sign in to do that
Don't have an account?
Soundar Rajan Ponpandi
Update Existing records by Upload CSV File
Hi Expert,
I Have One Requirement,
1. Want to update Sales_Order__c record's (going to update Sap_Number__c , SAP_createdDate__c).
2.Click to Upload Excel File.
3. Click to Update Sales Order Button .
4.Need To Updae With Existing Records (With same Rcords).
5. I designed a Visualforce pages as well, please give me a good idea to how can i achieve this Process with the Apex.
Regards,
Soundar.
I Have One Requirement,
1. Want to update Sales_Order__c record's (going to update Sap_Number__c , SAP_createdDate__c).
2.Click to Upload Excel File.
3. Click to Update Sales Order Button .
4.Need To Updae With Existing Records (With same Rcords).
5. I designed a Visualforce pages as well, please give me a good idea to how can i achieve this Process with the Apex.
Regards,
Soundar.
Finally I achieve This Process By Following Way ... Thanks For Your Valuable Suggestion
@Controller
Regards,
Soundar.
All Answers
Data Import Wizard to update records.May I suggest you please refer the below link for reference.
- https://help.salesforce.com/articleView?id=faq_import_general_update_with_import_wizard.htm&type=0
Hope it will be helpful.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
Import CSV file using apex visual force:
Normally we use Apex data loader to import data in Salesforce from CSV file. Nowadays some other tools are also available to load data in Salesforce like Jitterbit data loader. But sometimes there is a requirement when end users do not want to use Apex Data loader. They want some custom page to load data in Salesforce. Then, in that case, we can use custom code to load data in Salesforce from a CSV(http://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/) file.
Also sometimes using single CSV file we want to load data in multiple objects. Then, in that case, we can not use data loader to load data. In that case, we can use custom code to load data in Salesforce.
In the example below, we are loading data from CSV file for account objects.
First of all, we need CSV file format. Click here to download CSV file. You can modify CSV file to insert or import account records. CSV file attached has the following format:
Now we need to write code in Apex and visual force which will read a CSV file and insert records in account object.
Click on choose file, then select a CSV file and then click on ‘Import Account’ button. All records from CSV file will be inserted on account records. I have commented insert account line. So this example will only show account records on a visual force page. You can uncomment insert account list line in below code if you want to insert account list.
"May I suggest you please check with sample code below which will insert records using apex and visual force and streak it as per your requirement which will point you in the right direction."
Visual Force Page: Apex Controller: For more information please check with below links.
Hope this helps.
Kindly mark this as solved if it's resolved.
Thanks,
Nagendra
Hearty thanks for your quick response.
As per your suggestion a record can be insert. Can you please show sample code how can i update a records.
1. Initially i have export Sales Orders from Salesfroce.
2. After That i have maken few changes in this excell by uploading in SAP (......In Another Org).
3.After that i have import modified excel into salesforce. (Same Data is there in salesforce, Now i am going to update modified records into existing records) , two fields only will be going to change .
Note : I want to update through the visualforce page only. So only i avoided Standard Import & Export Tools Like import Wizard, Data loader , Etc...
Regards,
Soundar
Really Thanks For your quick response... i want to update the records by using the visualforce page only. Please give me good solution.
Regards,
Soundar.
Finally I achieve This Process By Following Way ... Thanks For Your Valuable Suggestion
@Controller
Regards,
Soundar.
Unable to upload morethan 5MB file through LWC to Salesforce file object . Can you please help me?
Thanks,
I am working on exactly same scenario , i have a date field in csv that needs to be updated in salesforce , I tried handling it the way you did it but am getting error .Could you please suggest what could be done .
Thanks in advance