CSV Data Exporter is a Salesforce Lightning Web Component (LWC) that simplifies the process of exporting data from Salesforce objects into CSV format. This component provides a user-friendly interface for selecting and exporting records, making it easier for users to retrieve data for reporting and analysis.
- Export data from Salesforce objects to CSV files.
- Choose specific records or export all records.
- Customize exported fields to meet your requirements.
- Designed for Salesforce Lightning Experience.
To use this Lightning Web Component in your Salesforce org, follow these steps:
-
Clone or Download this Repository:
- Clone this GitHub repository to your local machine using the following command:
git clone https://github.com/s4SHIVam7/csvDataExporter_lwc.git
- Clone this GitHub repository to your local machine using the following command:
-
Deploy the Lightning Web Component:
- Deploy the
CsvDataExporter
Lightning Web Component to your Salesforce org.
- Deploy the
-
Configure the Apex Controller:
- Modify the
CsvController
Apex class to fetch the data you want to export.
- Modify the
-
Add the Component to Your Salesforce Page:
- Add the
CsvDataExporter
component to your Lightning App or Record Page.
- Add the
-
Open a Salesforce Lightning Page or App:
- Navigate to a Salesforce Lightning Page or App where you've added the
CsvDataExporter
component.
- Navigate to a Salesforce Lightning Page or App where you've added the
-
Select Records for Export:
- Select the records you want to export by checking the checkboxes in the data table.
-
Export Data:
- Click the "Export Data" button.
-
Download CSV File:
- A CSV file containing the selected data will be generated and downloaded.
You can customize the fields that are exported by modifying the columns
property in the CsvDataExporter.js
file. Adjust the label
, fieldName
, and type
as needed to match your Salesforce object's schema.
columns = [
{ label: 'Account Name', fieldName: 'Name' },
{ label: 'Phone', fieldName: 'Phone', type: 'phone' },
{ label: 'Industry', fieldName: 'Industry', type: 'text' }
];
Additionally, you can customize the Apex class and SOQL query in the CsvController to fetch data from your specific Salesforce objects. Update the class and query to match your Salesforce data structure.
public static List<Account> fetchRecords() {
return [SELECT Id, Name, Phone, Industry From Account WHERE Phone != null ORDER BY LastModifiedDate DESC Limit 20];
}
For questions, support, or feedback, please feel free to reach out:
- Telegram: @shivam_l
- LinkedIn: Shivam Laidwar