Export & Import Multiple Custom Setting Records Using LWC
This project demonstrates how to export and import multiple Custom Setting records in Salesforce using Lightning Web Components (LWC) and Apex integration.
✨ Features
- Export Custom Setting records to CSV
- Import records using file upload
- Apex-based backend processing
- Lightning Web Component UI
- Reusable architecture
📁 Project Structure
Export-ImportMultipleCustomSettingRecordsUsingLWC/
│
├── force-app/
│ └── main/
│ └── default/
│ ├── classes/
│ └── lwc/
│
├── README.md
└── sfdx-project.json
⚙️ Apex Controller
public with sharing class ExportCustomSettingController {
@AuraEnabled(cacheable=true)
public static List getCustomSettings() {
return new List{'Setting A', 'Setting B'};
}
@AuraEnabled
public static String processFile(String fileContent) {
// Logic to parse CSV and insert records
return 'File processed successfully';
}
}
💻 LWC Component
HTML
<template>
<lightning-card title="Custom Settings Export/Import">
<lightning-button label="Export" onclick={handleExport}></lightning-button>
<lightning-button label="Import" onclick={handleImport}></lightning-button>
</lightning-card>
</template>
JavaScript
import { LightningElement } from 'lwc';
export default class CustomSetting extends LightningElement {
handleExport() {
console.log('Export triggered');
}
handleImport() {
console.log('Import triggered');
}
}
🔗 GitHub Repository
Access full source code here:
View on GitHub⬇ Download Source Code
Download ZIP📌 Conclusion
This project helps Salesforce developers understand how to handle bulk data export/import using Lightning Web Components and Apex. It can be extended for Custom Metadata, Objects, or API integrations.
No comments:
Post a Comment