You need to sign in to do that
Don't have an account?
bet account
how to upload data to multiple objects from csv file through custom visualforcepage
hai
please tell me the code to insert records related to multiple objects with the data from csv file using custom visualforce upload page, you can see preview of my page attached here
Thanks in advance
please tell me the code to insert records related to multiple objects with the data from csv file using custom visualforce upload page, you can see preview of my page attached here
Thanks in advance
Please find the detailed explanation for uploading a CSV file using visual force page.
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 CSV 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.
Now we need to write code in Apex and visual force which will read CSV file and insert records in account object.
Click on choose file, then select 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 the visualforce page. You can uncomment insert account list line in below code if you want to insert account list.
Visualforce Page: Apex Controller: Mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
the below code for insering records for account and contact at a time
How can you write the test code for this method?