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.