Tuesday, June 30, 2026

LWC: Reusable Donut / Pie Chart Component

๐Ÿฉ Reusable Donut / Pie Chart Component for Salesforce LWC

A fully reusable SVG-based Lightning Web Component that renders beautiful, interactive Donut and Pie Charts using pure SVG with zero external JavaScript libraries.

๐Ÿ“– Project Overview

The Donut / Pie Chart Component is a reusable Lightning Web Component built entirely with native Salesforce technologies. It renders interactive charts using pure SVG, supports Apex-powered dynamic data as well as static datasets, and provides configurable legends, animated slices, hover tooltips, accessibility support, and responsive layouts.

Unlike third-party charting libraries, this solution requires zero external dependencies, making deployment simple while maintaining excellent performance and Lightning compatibility.

✨ Key Features

Feature Description
Pure SVG RenderingNo Canvas or third-party chart libraries required.
Donut & Pie ModesSwitch between Donut and Pie using a single property.
Animated SlicesHovered slices expand while remaining slices fade.
Interactive TooltipsDisplays label, value, and percentage on hover.
Configurable LegendSupports stacked and side-by-side layouts.
Dynamic Apex DataAutomatically loads data using Apex Wire.
Static Data SupportAccepts custom chart data from parent components.
Responsive LayoutAutomatically adapts to desktop and mobile screens.
AccessibilityKeyboard navigation, ARIA labels and focus support.
Loading & Error StatesBuilt-in loading, empty data and error handling.

๐Ÿ— Component Architecture

Donut Chart - LWC Component Architecture

๐Ÿ“ Project Structure

force-app
└── main
    └── default
        ├── classes
        │   └── DonutChartController.cls
        │
        └── lwc
            └── donutChart
                ├── donutChart.html
                ├── donutChart.js
                ├── donutChart.css
                └── donutChart.js-meta.xml

⚙️ Public API Properties

Property Purpose
titleChart title displayed above the component.
chartTypeChoose between donut or pie.
chartDataStatic chart data supplied by parent LWC.
recordIdAutomatically loads Apex data.
colorPaletteCustom array of chart colors.
showLegendDisplay chart legend.
legendPositionStacked or Side-by-Side layout.
showCenterTextDisplay total value inside the donut.
valuePrefix / valueSuffixFormat displayed values.

๐Ÿ’ป Usage Example

<c-donut-chart
    title="Revenue by Stage"
    chart-type="donut"
    show-legend
    legend-position="side-by-side"
    show-center-text
    center-label="Total"
    value-prefix="$"
    chart-data={opportunityData}>
</c-donut-chart>

๐Ÿ“Š Supported Features

  • Donut Charts
  • Pie Charts
  • Static Data
  • Apex Wire Data
  • Hover Animation
  • Keyboard Navigation
  • ARIA Accessibility
  • Responsive Layout
  • Custom Color Palette
  • Legend Totals
  • Loading State
  • Error State
  • Empty Data State

๐ŸŽจ Customisation Options

✔ Custom Color Palette

✔ Legend Title

✔ Legend Position

✔ Center Label

✔ Value Prefix

✔ Value Suffix

✔ Label Field Mapping

✔ Value Field Mapping

✔ Donut / Pie Mode

♿ Accessibility

  • Keyboard accessible slices.
  • Tab navigation support.
  • Meaningful ARIA labels.
  • Screen reader friendly.
  • High contrast compatible.
  • Mobile responsive layout.

๐Ÿš€ Deployment

sf org login web --alias myOrg

sf project deploy start \
--source-dir force-app \
--target-org myOrg

๐ŸŽฏ Business Use Cases

  • Sales Pipeline Distribution
  • Opportunity Stage Analysis
  • Case Status Dashboard
  • Lead Source Analytics
  • Revenue Breakdown
  • Account Segmentation
  • Executive Dashboards
  • Service Performance Reports
  • Custom CRM Analytics

๐Ÿ“Œ Conclusion

The Reusable Donut / Pie Chart Component provides a lightweight, modern, and highly configurable visualization solution for Salesforce Lightning applications. Built entirely with native SVG, Lightning Web Components, and Apex, it delivers interactive charts without relying on external JavaScript libraries, making it ideal for enterprise Salesforce projects that require performance, accessibility, and easy customization.

Monday, June 29, 2026

LWC: Scheduled Job Monitor

⏰ Scheduled Job Monitor for Salesforce LWC

Monitor, manage, and analyze Salesforce Scheduled Apex Jobs directly from Lightning Experience with a modern reusable Lightning Web Component.

๐Ÿ“– Project Overview

Scheduled Job Monitor is a reusable Lightning Web Component that provides administrators and developers with a centralized dashboard for monitoring Salesforce Scheduled Apex Jobs.

Instead of navigating through Salesforce Setup pages, users can view scheduled jobs, inspect execution details, monitor upcoming schedules, abort running jobs, refresh data, search jobs, and analyze execution status directly from Lightning Experience.

The solution is built using Lightning Web Components, Apex, and Salesforce CronTrigger APIs while following Salesforce security best practices.

✨ Key Features

Feature Description
Scheduled Job Dashboard View all scheduled Apex jobs from a single Lightning page.
Real-Time Refresh Reload latest job information without leaving the page.
Search Jobs Quickly locate scheduled jobs by name.
Status Monitoring Track Waiting, Acquired, Executing, Complete, Error and Deleted jobs.
Abort Scheduled Jobs Cancel scheduled jobs directly from Lightning.
Execution Details Display next execution time, previous execution and schedule information.
Toast Notifications Success and error messages for all operations.
Responsive Design Works across desktop and tablet Lightning Experience.

๐Ÿ— Solution Architecture

Scheduled Job Monitor Architecture

๐Ÿ“ Project Structure

force-app
└── main
    └── default
        ├── classes
        │   ├── ScheduledJobMonitorController.cls
        │   └── ScheduledJobMonitorControllerTest.cls
        │
        ├── lwc
        │   └── scheduledJobMonitor
        │       ├── scheduledJobMonitor.html
        │       ├── scheduledJobMonitor.js
        │       ├── scheduledJobMonitor.css
        │       └── scheduledJobMonitor.js-meta.xml
        │
        └── permissionsets
            └── ScheduledJobMonitor.permissionset-meta.xml

⚙️ Dashboard Information

Column Description
Job NameScheduled Apex class name.
StateCurrent execution status.
Cron ExpressionComplete scheduling expression.
Next Fire TimeNext scheduled execution.
Previous Fire TimeLast successful execution.
Times TriggeredExecution count.
ActionsAbort and refresh operations.

๐Ÿ”„ Monitoring Workflow

Load Dashboard
      │
      ▼
Retrieve CronTrigger Records
      │
      ▼
Display Scheduled Jobs
      │
      ▼
Search / Filter Jobs
      │
      ▼
Review Execution Details
      │
      ▼
Abort Job (Optional)
      │
      ▼
Refresh Dashboard

๐Ÿ“Š Supported Job States

WAITING
ACQUIRED
EXECUTING
COMPLETE
ERROR
DELETED

๐Ÿ”’ Security

  • Uses with sharing Apex controllers.
  • Supports Salesforce CRUD and Field-Level Security.
  • Respects user permissions while displaying scheduled jobs.
  • Permission Set included for easy deployment.
  • Native Salesforce scheduler APIs used without external integrations.

๐Ÿš€ Deployment

sf org login web --alias myOrg

sf project deploy start \
--source-dir force-app \
--target-org myOrg

sf org assign permset \
--name ScheduledJobMonitor

sf apex run test \
--class-names ScheduledJobMonitorControllerTest

๐ŸŽฏ Business Benefits

  • Eliminates navigation to Salesforce Setup.
  • Provides centralized scheduled job monitoring.
  • Improves administrator productivity.
  • Quickly identifies failed or inactive jobs.
  • Supports one-click job cancellation.
  • Reusable across multiple Salesforce organizations.
  • Modern Lightning user experience.

๐Ÿ“Œ Conclusion

The Scheduled Job Monitor provides Salesforce administrators and developers with a simple yet powerful interface for managing Scheduled Apex Jobs. By combining Lightning Web Components, Apex, and Salesforce scheduling APIs, the solution delivers real-time visibility into scheduled processes while simplifying monitoring and administration from within Lightning Experience.

Sunday, June 28, 2026

LWC: PDF Generator Button

๐Ÿ“„ PDF Generator Button for Salesforce LWC

Generate professional PDF documents from any Salesforce record with a single click, automatically save them as Salesforce Files, and maintain a complete PDF history.

๐Ÿ“– Project Overview

PDF Generator Button is a reusable Lightning Web Component that enables users to generate PDF documents directly from Salesforce record pages.

The component renders a configurable Visualforce page as a PDF, stores it as a Salesforce File (ContentVersion), automatically links it back to the source record, and displays recently generated PDFs for quick access.

Designed for enterprise Salesforce applications, the solution works across standard and custom objects without requiring object-specific code.

✨ Key Features

Feature Description
One-Click PDF GenerationGenerate PDFs directly from Lightning record pages.
Reusable Across ObjectsSupports Account, Contact, Opportunity and custom objects.
Automatic File NamingCreates descriptive file names automatically or allows a custom name.
Salesforce Files IntegrationCreates ContentVersion and ContentDocumentLink records automatically.
PDF HistoryDisplays the latest generated PDFs for each record.
Download SupportOpen or download generated PDFs directly.
Toast NotificationsInstant success and error feedback.
Configurable TemplateUse any Visualforce page as the PDF template.
Permission Set IncludedEasy deployment using the included permission set.

๐Ÿ— Architecture

PDF Generator LWC Architecture Diagram

๐Ÿ“ Project Structure

force-app/main/default
│
├── lwc
│   └── pdfGeneratorButton
│       ├── pdfGeneratorButton.html
│       ├── pdfGeneratorButton.js
│       ├── pdfGeneratorButton.css
│       └── pdfGeneratorButton.js-meta.xml
│
├── classes
│   ├── PdfGeneratorController.cls
│   ├── PdfGeneratorControllerTest.cls
│   ├── RecordPdfPageController.cls
│   └── RecordPdfPageControllerTest.cls
│
├── pages
│   └── RecordPdfPage.page
│
└── permissionsets
    └── PdfGenerator.permissionset-meta.xml

⚙️ Lightning App Builder Configuration

Property Default Description
buttonLabel Generate PDF Custom label displayed on the button.
vfPageName RecordPdfPage Visualforce page used to generate the PDF.
pdfFileName Auto Generated Optional static PDF filename.

๐Ÿ”„ PDF Generation Flow

Open Record
      │
      ▼
Click "Generate PDF"
      │
      ▼
Visualforce Page Rendered
      │
      ▼
PDF Created
      │
      ▼
ContentVersion Created
      │
      ▼
ContentDocument Linked
      │
      ▼
PDF History Refreshed

๐Ÿ“‚ Automatic File Naming

__.pdf

Example:

Account_001XXXXXXXXXXXX_2026-06-28.pdf

๐Ÿ“œ PDF History

  • Displays the latest 20 generated PDF files.
  • Shows files linked to the current record.
  • One-click preview and download.
  • Automatically refreshes after generating a new PDF.

๐Ÿงฉ Custom PDF Templates

The component supports any Visualforce page as a PDF template. Simply specify the Visualforce page API name in the component configuration to generate customized invoices, quotations, certificates, reports, contracts, or business documents.

๐Ÿ” Security Features

  • Uses with sharing Apex controllers.
  • Respects Salesforce record-level security.
  • Stores documents using native Salesforce Files.
  • Supports controlled rollout through the included permission set.
  • Works with standard Salesforce authentication.

๐Ÿš€ Deployment

sf org login web --alias myOrg

sf project deploy start \
--source-dir force-app \
--target-org myOrg

sf org assign permset \
--name PdfGenerator

sf apex run test \
--class-names PdfGeneratorControllerTest,RecordPdfPageControllerTest

๐ŸŽฏ Business Use Cases

  • Invoice Generation
  • Sales Quotations
  • Customer Agreements
  • Booking Confirmations
  • Service Reports
  • Purchase Orders
  • Certificates
  • Inspection Reports
  • Healthcare Documents
  • Custom Business Forms

๐Ÿ“Œ Conclusion

The PDF Generator Button is a reusable Salesforce Lightning Web Component that streamlines PDF creation directly from Lightning record pages. By combining Lightning Web Components, Apex, Visualforce, and Salesforce Files, it provides a simple, secure, and scalable solution for generating and managing business documents across any Salesforce object.

Thursday, June 25, 2026

LWC: Post Booking Portal

๐ŸŽซ Salesforce Post Booking Portal

A complete post-booking management solution built on Salesforce that empowers customers to manage reservations, modify bookings, download invoices, request cancellations, and track booking history through a modern self-service portal.

๐Ÿ“– Project Overview

Salesforce Post Booking Portal extends the customer journey beyond the initial reservation process by providing a centralized self-service experience for managing existing bookings.

Customers can view upcoming reservations, update booking details, reschedule appointments, request cancellations, download invoices, track payment history, and receive automated notifications.

Built using Salesforce Lightning Web Components (LWC), Apex, Experience Cloud, Flows, Platform Events, and Custom Metadata, the solution delivers a scalable and enterprise-ready booking management platform.

๐Ÿ— Solution Architecture

Post Booking Portal Solution Architecture

✨ Key Features

Module Capabilities
Booking Dashboard View active, upcoming, completed, and cancelled bookings.
Booking Management Reschedule, modify, upgrade, or cancel reservations.
Invoice Center Download invoices, receipts, and payment confirmations.
Payment History Track completed and pending payments.
Notifications Email, SMS, and in-app booking updates.
Support Requests Raise issues and customer service requests.

๐Ÿ”„ Post Booking Journey

Booking Created
      │
      ▼
Confirmation Sent
      │
      ▼
Customer Portal Login
      │
      ▼
View Booking Details
      │
 ┌────┼─────┬─────┐
 ▼    ▼     ▼     ▼
Edit  Pay  Download Cancel
      │
      ▼
Notifications Triggered
      │
      ▼
Booking Updated

๐Ÿ“ Project Structure

force-app/main/default

├── classes
│   ├── PostBookingController.cls
│   ├── PaymentHistoryController.cls
│   ├── InvoiceController.cls
│   └── NotificationController.cls
│
├── lwc
│   ├── bookingDashboard
│   ├── bookingDetails
│   ├── bookingReschedule
│   ├── invoiceCenter
│   ├── paymentHistory
│   └── supportRequestPanel
│
├── flows
│
├── platformEvents
│
└── customMetadata

๐Ÿ’ป LWC Components

Component Purpose
bookingDashboard Displays all customer bookings.
bookingDetails Shows booking information and status.
bookingReschedule Handles appointment or reservation changes.
invoiceCenter Invoice download and payment receipts.
paymentHistory Displays transaction history.
supportRequestPanel Customer support and issue management.

๐Ÿ“Š Dashboard Widgets

  • Upcoming Bookings
  • Completed Reservations
  • Pending Payments
  • Recent Transactions
  • Cancellation Requests
  • Support Tickets
  • Booking Statistics
  • Customer Notifications

๐Ÿ’ณ Payment & Invoice Management

Booking
   │
   ▼
Payment Record
   │
   ▼
Invoice Generation
   │
   ▼
PDF Receipt
   │
   ▼
Email Delivery

๐Ÿ“ข Notification Framework

  • Booking Modification Alerts
  • Cancellation Confirmations
  • Reschedule Notifications
  • Payment Success Messages
  • Refund Updates
  • Reminder Notifications
  • Support Ticket Responses

๐Ÿ” Security Features

Security Layer Implementation
Authentication Experience Cloud Login & SSO.
Authorization Role-based access control.
Data Security CRUD/FLS enforcement.
Apex Security with sharing controllers.

๐Ÿš€ Deployment

sf org login web --alias booking-portal

sf project deploy start \
--source-dir force-app \
--target-org booking-portal

sf apex run test

๐ŸŽฏ Business Benefits

  • Reduces customer support workload.
  • Provides self-service booking management.
  • Improves customer satisfaction.
  • Automates post-booking communication.
  • Centralizes invoices and payment history.
  • Scales easily with Experience Cloud.
  • Enhances operational efficiency.

๐Ÿ“Œ Conclusion

Salesforce Post Booking Portal provides a comprehensive self-service experience for customers after a reservation has been completed. By combining Lightning Web Components, Apex, Experience Cloud, Flows, and Platform Events, organizations can deliver a seamless post-booking journey that improves customer engagement, reduces support costs, and streamlines booking operations.

Sunday, June 21, 2026

LWC: Booking Portal

๐Ÿ“… Salesforce Booking Portal

A complete multi-purpose booking platform built on Salesforce using Lightning Web Components, Apex, Flows, Platform Events, Stripe, PayPal, and native Salesforce automation.

๐Ÿ“– Project Overview

Salesforce Booking Portal is a full-featured booking management solution that covers the entire customer journey from resource discovery to reservation, payment processing, confirmation, notifications, and operational management.

The platform is designed using Salesforce native technologies including Lightning Web Components (LWC), Apex Controllers, Custom Objects, Platform Events, Flows, Named Credentials, and Custom Metadata Types.

The solution supports various booking scenarios such as rooms, appointments, seats, equipment rentals, training sessions, healthcare appointments, and service scheduling.

๐Ÿ— Solution Architecture

Booking Portal Full Architecture Diagram

✨ Key Features

Module Capabilities
Booking Engine Availability search, slot reservation, temporary holds, booking references.
Pricing Engine Dynamic pricing, surge pricing, promotions, loyalty discounts.
Payment Processing Stripe, PayPal, saved payment methods, split payments.
Confirmation Booking receipts, invoices, calendar exports.
Notifications Email, SMS, reminders, status updates.
Operations Admin dashboard, reporting, analytics, booking management.

๐Ÿ›’ 4-Step Booking Checkout Flow

Step 1 → Select Resource & Time Slot

Step 2 → Review Pricing & Promotions

Step 3 → Enter Payment Information

Step 4 → Booking Confirmation & Invoice

๐Ÿ“ Project Structure

force-app/main/default

├── classes
│   ├── BookingEngineController.cls
│   ├── PricingController.cls
│   └── PaymentController.cls
│
└── lwc
    ├── bookingCheckoutStepper
    ├── resourceSelector
    ├── pricingPanel
    ├── paymentProcessor
    └── bookingConfirmation

⚙️ LWC Component Architecture

c-booking-checkout-stepper
│
├── c-resource-selector
│
├── c-pricing-panel
│
├── c-payment-processor
│
└── c-booking-confirmation

๐Ÿ” Booking Engine Features

  • Resource Type Filtering
  • Availability Search
  • Date and Time Selection
  • Party Size Management
  • Real-Time Availability Checks
  • Temporary Hold Creation
  • Automatic Hold Expiration
  • Booking Reference Generation
  • Calendar Integration
  • Invoice Generation

๐Ÿ’ฐ Pricing & Promotion Engine

Base Price
   +
Surge Pricing
   +
Seasonal Adjustment
   -
Promo Discount
   -
Loyalty Discount
   +
Tax
   =
Final Total

Promotion Validation

  • Promotion must be active.
  • Current date must be within validity period.
  • Usage limit validation.
  • Minimum order amount validation.
  • Listing eligibility validation.
  • Single-use restriction validation.

๐Ÿ’ณ Payment Processing

Method Implementation
Credit/Debit Cards Stripe Payment Intents
PayPal PayPal Orders API
Saved Methods Stored payment profiles
Split Payments 2–10 participant payment sharing

๐Ÿ“ฆ Apex Controllers

Controller Responsibility
BookingEngineController Availability search, booking holds, booking confirmation.
PricingController Pricing calculations and discount processing.
PaymentController Payment processing and booking finalization.

๐Ÿ”„ End-to-End Data Flow

Customer Search
      │
      ▼
Resource Selection
      │
      ▼
Temporary Hold
      │
      ▼
Pricing Calculation
      │
      ▼
Payment Authorization
      │
      ▼
Booking Creation
      │
      ▼
Platform Event Published
      │
      ▼
Notification Flow Triggered
      │
      ▼
Confirmation Delivered

๐Ÿ” Security & Compliance

  • with sharing Apex Controllers
  • Named Credentials for external integrations
  • Secure payment tokenization
  • Custom Metadata driven configuration
  • Role-based access control
  • Platform Event audit trail
  • PCI-friendly payment architecture
  • GDPR-ready data management approach

๐Ÿš€ Deployment

sf org login web --alias booking-org

sf project deploy start \
--source-dir force-app \
--target-org booking-org

sf apex run test

๐ŸŽฏ Business Use Cases

  • Hotel & Resort Reservations
  • Healthcare Appointment Scheduling
  • Training & Event Registrations
  • Equipment Rental Systems
  • Conference Room Booking
  • Consultation Scheduling
  • Sports Facility Reservations
  • Professional Services Booking

๐Ÿ“Œ Conclusion

Salesforce Booking Portal demonstrates how a complete enterprise-grade booking solution can be built entirely on the Salesforce Platform. By combining Lightning Web Components, Apex, Flows, Platform Events, Stripe, PayPal, and configurable metadata, the application delivers a scalable booking experience covering discovery, reservation, payment, confirmation, and operational management.

Saturday, June 20, 2026

LWC: Mass Update Panel

⚡ 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.

Mass Update Panel for Salesforce LWC

✨ 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

Text
Picklist
Multi Picklist
Boolean
Currency
Percent
Integer
Double
Date
DateTime
Email
Phone
URL

↩ 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.

Friday, June 19, 2026

LWC: Reusable Related List View

๐Ÿ“‹ Reusable Related List View for Salesforce LWC

A fully configurable Lightning Web Component that renders Salesforce related lists with pagination, sorting, search, inline editing, CSV export, row actions, and record management.

๐Ÿ“– Project Overview

relatedListView is a production-ready Salesforce Lightning Web Component designed to display related records dynamically without writing custom code for each object relationship.

The component is fully configurable through Lightning App Builder and supports pagination, server-side sorting, searching, CSV export, row actions, bulk selection, inline editing, and New/Edit record management.

Administrators can configure object names, parent relationships, columns, page sizes, and actions directly from App Builder, making the component reusable across multiple Salesforce implementations.

Reusable Related List View

✨ Key Features

Feature Description
Configurable Columns JSON-driven column configuration with labels, types, sorting, and editing support.
Pagination Supports 5, 10, 25, 50, and 100 record page sizes.
Server-Side Sorting ORDER BY support with persistent sorting across pages.
Search Debounced search filtering using SOQL LIKE queries.
Inline Editing Edit records directly inside lightning-datatable.
Row Actions View, Edit, Delete, and custom row actions.
CSV Export Export visible records to CSV format.
Bulk Selection Checkbox selection with event-based record handling.
New/Edit Modal Record creation and editing using lightning-record-edit-form.

๐Ÿ— Architecture

App Builder / Parent Component
            │
            ▼
     relatedListView
            │
 ┌──────────┼──────────┐
 │          │          │
 ▼          ▼          ▼
Header   Datatable  Pagination
Actions   Search     Controls
 │          │          │
 └──────┬───┴──────┬───┘
        ▼          ▼
  Record Modal  Delete Modal
        │
        ▼
RelatedListController.cls
        │
 ┌──────┴─────────────┐
 │                    │
 ▼                    ▼
getRelatedRecords()  getTotalCount()
        │
        ▼
 Dynamic SOQL Queries

๐Ÿ“ Project Structure

force-app
└── main
    └── default
        ├── classes
        │   ├── RelatedListController.cls
        │   └── RelatedListControllerTest.cls
        │
        └── lwc
            └── relatedListView
                ├── relatedListView.html
                ├── relatedListView.js
                ├── relatedListView.css
                └── relatedListView.js-meta.xml

README.md

⚙️ Lightning App Builder Configuration

Property Purpose
Object API Name Target child object.
Parent Field API Name Lookup relationship field.
Columns JSON Dynamic datatable configuration.
Page Size Records per page.
Enable Selection Show row selection checkboxes.

๐Ÿงฉ Column Configuration Example

[
  {
    "label": "Contact Name",
    "fieldName": "Name",
    "type": "text",
    "sortable": true
  },
  {
    "label": "Email",
    "fieldName": "Email",
    "type": "email"
  },
  {
    "label": "Phone",
    "fieldName": "Phone",
    "type": "phone"
  }
]

๐Ÿ’ป Component Usage Example

<c-related-list-view
    record-id={recordId}
    object-api-name="Contact"
    parent-field-api-name="AccountId"
    page-size="25"
    columns-json={columnConfig}>
</c-related-list-view>

๐Ÿ” Supported User Actions

  • View Record
  • Edit Record
  • Delete Record
  • Create New Record
  • Refresh Data
  • Search Records
  • Export CSV
  • Select Multiple Rows
  • Inline Save

๐Ÿ“ค CSV Export

The component can export currently visible records to CSV format while respecting configured columns and applied filters.

Header Actions
    │
    ▼
Export CSV
    │
    ▼
Generate Blob
    │
    ▼
Download File

๐Ÿ”’ Security Considerations

  • Uses with sharing Apex classes.
  • Supports Salesforce CRUD permissions.
  • Supports Field-Level Security.
  • Dynamic SOQL validation implemented.
  • Safe handling of configurable properties.

๐Ÿงช Testing

  • RelatedListControllerTest.cls included.
  • Pagination testing.
  • Sorting validation.
  • Search functionality verification.
  • CRUD operation testing.

๐Ÿš€ Deployment

sf org login web -a myOrg

sf project deploy start \
--source-dir force-app \
-o myOrg

๐ŸŽฏ Benefits

  • Eliminates custom related list development.
  • Highly reusable across multiple objects.
  • Admin-friendly configuration.
  • Modern Lightning user experience.
  • Improves productivity and maintainability.
  • Enterprise-ready architecture.

๐Ÿ“Œ Conclusion

The LWC Related List View component provides a complete replacement for traditional Salesforce related lists with advanced features such as search, pagination, inline editing, CSV export, row actions, and configurable columns. Its metadata-driven design makes it an ideal reusable solution for enterprise Salesforce applications.

Thursday, June 18, 2026

LWC: Collapsible Accordion

๐ŸŽฏ Collapsible Accordion for Salesforce LWC

A reusable, accessible, animated accordion component for Lightning Web Components with support for single-expand, multi-expand, slot-based composition, and programmatic control.

๐Ÿ“– Project Overview

Salesforce LWC Accordion is a fully reusable Lightning Web Component designed to create modern, responsive, and accessible accordion interfaces.

The component supports both single-expand and multi-expand modes, animated transitions, programmatic APIs, optional icons and badges, and slot-based content composition.

Whether you're displaying account details, forms, datatables, dashboards, FAQs, or complex business content, this accordion provides a flexible and scalable solution for Salesforce applications.

Salesforce-LWC-Accordion-Architecture-Diagram

Salesforce-LWC-Accordion

✨ Key Features

Feature Description
Single Expand Mode Opening one section automatically closes others.
Multi Expand Mode Multiple sections can remain open simultaneously.
Expand All / Collapse All Bulk control of accordion sections.
Smooth Animations CSS-based expand/collapse transitions.
Animated Chevron Visual indicator rotates automatically.
Slot-Based Composition Supports tables, forms, charts, and custom markup.
Data-Driven API Generate sections dynamically using JavaScript arrays.
Accessibility Ready ARIA-compliant and keyboard-friendly.

๐Ÿ— Architecture

Parent Component
        │
        ▼
c-accordion
        │
        ├── State Management
        ├── Multi Expand Logic
        ├── Programmatic API
        │
        ▼
c-accordion-section
        │
        ├── Header
        ├── Chevron
        ├── Badge
        ├── Icon
        └── Content Panel

๐Ÿ“ Project Structure

salesforce-lwc-accordion
│
├── README.md
│
└── force-app
    └── main
        └── default
            └── lwc
                ├── accordion
                │   ├── accordion.html
                │   ├── accordion.js
                │   ├── accordion.css
                │   └── accordion.js-meta.xml
                │
                ├── accordionSection
                │   ├── accordionSection.html
                │   ├── accordionSection.js
                │   ├── accordionSection.css
                │   └── accordionSection.js-meta.xml
                │
                └── accordionDemo
                    ├── accordionDemo.html
                    ├── accordionDemo.js
                    └── accordionDemo.js-meta.xml

๐Ÿ’ป Data-Driven Usage (Recommended)

<c-accordion
    title="Account Information"
    sections={mySections}
    allow-multi-expand={isMultiExpand}
    active-section-names={defaultOpen}
    onsectiontoggle={handleToggle}>
</c-accordion>

JavaScript Configuration

mySections = [
{
    name: 'details',
    label: 'Account Details',
    iconName: 'utility:account',
    content: 'Core account information.'
},
{
    name: 'contacts',
    label: 'Contacts',
    iconName: 'utility:people',
    badge: '5',
    content: 'Associated contacts.'
}
];

๐ŸŽจ Slot-Based Composition

<c-accordion-section icon-name="utility:opportunity" is-open="" label="Opportunity Summary" name="summary">
    <lightning-datatable columns="{columns}" data="{tableData}" key-field="id">
    </lightning-datatable>
</c-accordion-section>

⚙️ Programmatic Control API

Method Description
expandSection(name) Open a section programmatically.
collapseSection(name) Close a section programmatically.
getOpenSections() Returns all currently expanded sections.

Example

openContacts() {
    this.refs.myAccordion.expandSection('contacts');
}

logOpen() {
    const openSections =
        this.refs.myAccordion.getOpenSections();
}

๐Ÿ“ฆ Section Object Schema

{
    name: String,
    label: String,
    content: String,
    iconName: String,
    badge: String,
    isDisabled: Boolean
}

๐Ÿ“ข Events

Event Purpose
sectiontoggle Triggered whenever sections open or close.
toggle Fired by individual accordion sections.

♿ Accessibility Features

  • Native button-based interaction
  • aria-expanded support
  • aria-controls support
  • role="region" implementation
  • aria-disabled support
  • Keyboard navigation (Tab, Enter, Space)
  • Visible focus indicators
  • Screen reader friendly design

๐ŸŽจ CSS Custom Properties

c-accordion {
    --accordion-section-max-height: 600px;
}

๐Ÿš€ Deployment

sf org login web --alias my-org

sf project deploy start \
--source-dir force-app/main/default/lwc/accordion \
--source-dir force-app/main/default/lwc/accordionSection \
--target-org my-org

๐ŸŽฏ Benefits

  • Reusable across multiple Salesforce projects.
  • Supports both simple and complex content layouts.
  • Fully configurable using metadata and JavaScript.
  • Provides enterprise-grade accessibility.
  • Clean architecture with reusable APIs.
  • Smooth user experience with animations.
  • App Builder and Flow Screen compatible.

๐Ÿ“Œ Conclusion

Salesforce LWC Accordion is a flexible and accessible solution for creating collapsible content areas in Lightning Web Components. With support for data-driven configuration, slot-based content, animated transitions, and programmatic control, it can be used across a wide range of Salesforce applications while maintaining a clean and modern user experience.

Wednesday, June 17, 2026

LWC: Debug Log Viewer

๐Ÿ“‹ Debug Log Viewer for Salesforce LWC

View, filter, search, download, and manage Apex Debug Logs directly from Lightning Experience without opening Salesforce Setup.

๐Ÿ“– Project Overview

Debug Log Viewer is a reusable Salesforce Lightning Web Component that reads ApexLog records through the Salesforce Tooling API and displays them directly inside Lightning Experience.

Developers and administrators can inspect logs, search log contents, filter by event types, download log files, copy log content, and even bulk delete logs without navigating to Setup.

The solution uses Lightning Web Components, Apex, Tooling API integration, and Named Credentials to provide a modern debugging experience.

Debug Log Viewer Architecture

✨ Key Features

Feature Description
Debug Log Listing View ApexLog records in a Lightning datatable.
Filter Panel Filter by User Id, Operation, and Status.
Pagination Load logs incrementally in batches.
Log Detail Viewer Display full log content inside a dark-theme modal.
Category Filters Filter USER_DEBUG, SOQL, DML, and other log events.
Search Within Logs Quickly find keywords inside large log files.
Copy to Clipboard Copy raw or filtered log output.
Download Logs Save logs locally as .log files.
Bulk Delete Delete multiple Apex logs simultaneously.
Toast Notifications Success and error feedback for all operations.

๐Ÿ— Architecture

Lightning App / Utility Bar
│
├── debugLogViewer (Parent)
│
├── debugLogFilter (Child)
│
└── debugLogDetail (Child)
        │
        ▼
DebugLogViewerController.cls
        │
        ▼
Named Credential
        │
        ▼
Salesforce Tooling API
        │
        ├── ApexLog Query
        ├── Log Body Retrieval
        └── Bulk Delete Operations

๐Ÿ“ Project Structure

debug-log-viewer
│
├── force-app
│   └── main
│       └── default
│
├── lwc
│   ├── debugLogViewer
│   ├── debugLogFilter
│   └── debugLogDetail
│
├── classes
│   ├── DebugLogViewerController.cls
│   └── DebugLogViewerControllerTest.cls
│
├── namedCredentials
│   └── SalesforceToolingAPI
│
├── permissionsets
│   └── DebugLogViewer
│
└── README.md

⚙️ Core Components

Component Purpose
debugLogViewer Main orchestration component.
debugLogFilter Filtering UI for logs.
debugLogDetail Displays log body and search results.

๐Ÿ”Ž Supported Filtering Options

  • User Id
  • Operation Name
  • Status
  • Date Sorting
  • Event Type Categories
  • Keyword Search

๐Ÿ’ป Example Tooling API Query

SELECT Id,
       LogUser.Name,
       Operation,
       Status,
       DurationMilliseconds,
       LogLength,
       StartTime
FROM ApexLog
ORDER BY StartTime DESC
LIMIT 50

๐Ÿ“‚ Log Event Categories

USER_DEBUG
SOQL_EXECUTE_BEGIN
SOQL_EXECUTE_END
DML_BEGIN
DML_END
METHOD_ENTRY
METHOD_EXIT
EXCEPTION_THROWN

๐Ÿš€ Deployment

sf org login web \
--instance-url https://test.salesforce.com

sf project deploy start \
--source-dir force-app

๐Ÿ” Prerequisites

  • Salesforce CLI (sf)
  • API Version 59+
  • Sandbox or Developer Edition Org
  • Connected App
  • Named Credential
  • Tooling API Access

๐ŸŽฏ Benefits

  • No need to open Salesforce Setup.
  • Faster debugging workflow.
  • Centralized log management.
  • Bulk deletion support.
  • Developer-friendly user experience.
  • Modern Lightning UI.

๐Ÿ“Œ Conclusion

Debug Log Viewer modernizes the Salesforce debugging experience by bringing Apex log management directly into Lightning Experience. With filtering, searching, downloading, and bulk management capabilities, it significantly improves developer productivity and reduces dependency on Setup-based tools.