⚡ Mass Update Panel for Salesforce LWC
Reusable Lightning Web Component for bulk updating records with field-type-aware inputs, mandatory confirmation, partial success reporting, and one-click rollback support.
๐ Project Overview
Mass Update Panel is a reusable Salesforce Lightning Web Component that allows users to update a single field across multiple records simultaneously.
The solution includes a guided workflow with row selection, dynamic field configuration, update preview, confirmation dialog, partial success handling, and rollback functionality.
Built using Lightning Web Components, Apex, and Salesforce security best practices, this component helps administrators and users perform safe bulk updates directly from Lightning Experience.
✨ Key Features
| Feature | Description |
|---|---|
| Multi-Record Selection | Supports checkbox-based bulk row selection. |
| Dynamic Input Types | Automatically renders controls based on Salesforce field type. |
| Preview Before Update | Displays selected field and new value before DML execution. |
| Confirmation Modal | Mandatory confirmation step before updating records. |
| Partial Success Handling | Supports allOrNone=false and displays failed records. |
| Rollback Support | Restore original values with one click. |
| Security Enforcement | CRUD/FLS validation using Security.stripInaccessible. |
| Zero Dependencies | Pure Apex, LWC, and SLDS implementation. |
๐ Architecture
Host Page / Lightning App
│
▼
massUpdatePanel
│
┌──────────┼───────────┐
│ │ │
▼ ▼ ▼
Datatable Field Picker Preview Bar
│
▼
massUpdateConfirmModal
│
▼
MassUpdateController.cls
│
┌──────────┼───────────┐
│ │ │
▼ ▼ ▼
getRecords() massUpdate() rollbackUpdate()
│
▼
Salesforce Database
๐ Project Structure
force-app/main/default
│
├── classes
│ ├── MassUpdateController.cls
│ └── MassUpdateControllerTest.cls
│
└── lwc
├── massUpdatePanel
│ ├── massUpdatePanel.html
│ ├── massUpdatePanel.js
│ └── massUpdatePanel.css
│
├── massUpdateConfirmModal
│ ├── massUpdateConfirmModal.html
│ ├── massUpdateConfirmModal.js
│ └── massUpdateConfirmModal.css
│
└── accountMassUpdatePage
├── accountMassUpdatePage.html
└── accountMassUpdatePage.js
๐ Update Workflow
Select Records
│
▼
Choose Field
│
▼
Enter New Value
│
▼
Preview Update
│
▼
Confirmation Modal
│
▼
Mass Update
│
▼
Success / Failure Report
│
▼
Optional Rollback
⚙️ Component Properties
| Property | Type | Description |
|---|---|---|
| sobjectApiName | String | Target Salesforce object. |
| records | Array | Records displayed in datatable. |
| columns | Array | Datatable column definitions. |
| editableFields | Array | Supported fields for mass updates. |
| maxRowSelection | Integer | Maximum selectable records. |
๐งฉ Usage Example
<c-mass-update-panel
sobject-api-name="Contact"
records={contacts}
columns={columns}
editable-fields={editableFields}
max-row-selection="300"
onmassupdate={handleUpdate}
onrollback={handleRollback}>
</c-mass-update-panel>
๐ Editable Field Configuration
{
label: 'Lead Source',
apiName: 'LeadSource',
type: 'picklist',
picklistOptions: [
{ label: 'Web', value: 'Web' },
{ label: 'Phone', value: 'Phone' },
{ label: 'Partner', value: 'Partner' }
]
}
๐ฏ Supported Field Types
↩ Rollback Functionality
- Original values are captured before update execution.
- Rollback snapshot is generated server-side.
- Only the most recent update can be rolled back.
- Rollback restores original field values.
- Partial rollback failures can be retried.
- Snapshot clears after successful rollback.
๐ Security Model
| Layer | Implementation |
|---|---|
| Object Security | Describe checks before querying records. |
| Field Security | Security.stripInaccessible enforcement. |
| Update Permissions | isUpdateable() validation. |
| Sharing Rules | Controller uses with sharing. |
๐งช Testing
- MassUpdateControllerTest.cls included.
- Mass update validation tests.
- Rollback testing scenarios.
- CRUD/FLS security validation.
- Partial success coverage.
๐ Deployment
sf org login web --alias my-sandbox sf project deploy start \ --source-dir force-app \ --target-org my-sandbox sf apex run test \ --class-names MassUpdateControllerTest
๐ฏ Benefits
- Reduces manual record maintenance.
- Improves user productivity.
- Provides safe bulk updates.
- Supports rollback recovery.
- Reusable across any Salesforce object.
- Enterprise-ready security model.
๐ Conclusion
Mass Update Panel is a powerful reusable Salesforce Lightning Web Component that simplifies bulk record management. With dynamic field handling, mandatory confirmations, partial success reporting, and rollback capabilities, it provides a secure and user-friendly approach to large-scale data updates in Salesforce.







