Showing posts with label Workflow & Process. Show all posts
Showing posts with label Workflow & Process. Show all posts

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.

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.