A Salesforce Lightning Web Component (LWC) solution for bulk exporting and importing Custom Setting records via CSV files — no data loader or third-party tools required.
- Select up to 30 Custom Settings at once for export
- Each setting is exported as a separate
.csvfile - Optional toggle to include system/read-only fields in the export
- Upload up to 10 CSV files per batch
- Validates that each filename matches the Custom Setting API name
- Processes records with partial-success support (failed rows do not block the rest)
- Automatically generates an error report CSV for any rows that failed to import
force-app/
├── classes/
│ ├── ImportAndExportCustomSettingController.cls
│ └── ImportAndExportCustomSettingController.cls-meta.xml
└── lwc/
├── importAndExportCustomSetting/
│ ├── importAndExportCustomSetting.html
│ ├── importAndExportCustomSetting.js
│ ├── importAndExportCustomSetting.js-meta.xml
│ └── __tests__/
└── utils/
| Method | Description |
|---|---|
getAllCustomSettings() |
Queries EntityDefinition to list all Custom Settings in the org |
getCustomSettingHeaders() |
Returns field API names and labels; filters out non-updateable fields unless "Export system fields" is enabled |
getCustomSettingData() |
Dynamically queries all fields for a given Custom Setting object |
loadData() |
Parses an uploaded CSV (ContentVersion), maps columns to fields, type-converts values, and inserts records via Database.insert with allOrNothing=false |
Supported field types for import: String, Date, DateTime, Double, Boolean, Integer.
The component renders a card with two modes toggled by radio buttons:
Export mode
- A dual-listbox lists all available Custom Settings.
- User selects settings and optionally checks "Export system fields as well".
- Clicking Export downloads one CSV per selected setting, staggered 1 second apart.
Import mode
- A dual-listbox lists the Custom Settings to import into.
- User uploads one or more
.csvfiles (filename must match the Custom Setting API name). - Clicking Import uploads each file to Salesforce Files, calls the Apex controller, and shows a success/failure count.
- If any rows fail, an error CSV is automatically downloaded.
| Limit | Value |
|---|---|
| Max exports per operation | 30 |
| Max imports per operation | 10 |
| Max records per import file | 5,000 |
| Accepted file format | .csv / .CSV |
| Import filename | Must exactly match the Custom Setting API name |
Deploy with Salesforce CLI:
sf project deploy start --source-dir force-appOr with the legacy SFDX CLI:
sfdx force:source:deploy -p force-appAfter deployment, add the importAndExportCustomSetting LWC to any App Page, Record Page, or Home Page via Lightning App Builder.
- Salesforce org with at least one Hierarchy or List Custom Setting
- User must have Customize Application or appropriate Custom Setting CRUD permissions
- API version 50.0+
- Open the page where the component is placed.
- Choose Export or Import mode using the toggle.
- To export: select one or more Custom Settings → click Export → CSV files download automatically.
- To import: select the target Custom Setting(s) → upload matching CSV files → click Import → review the success summary and any error CSV.
This project is open-source.