How ericrsmith35/datatablev2 works
Project type and purpose
• This is a Salesforce-DX project that packages a Lightning Web Component library (“datatableV2” and “richDatatable”) designed to run inside Salesforce Flow screens.
• It includes:
• LWC components (UI layer)
• Apex classes (SObjectController2) for data access
• Salesforce Flows (Datatable Configuration Helper) for run-time configuration
• A Packaging Manifest (package.xml) and SFDX config (sfdx-project.json) for deployment
File structure
• Top-level files & directories:
• config/project-scratch-def.json: Scratch org definition
• force-app/main/default/classes: Apex controllers & tests
• force-app/main/default/lwc: UI components (datatableV2, richDatatable) and JS configs
• force-app/main/default/flows: Flow definitions for configuration helper
• manifest/package.xml & sfdx-project.json: packaging/deployment metadata
• scripts/: sample Apex/soql scripts for dev/test
• Architectural clues:
• Separation of UI (LWC) vs. business logic (Apex) vs. orchestration (Flow)
• Uses Salesforce Metadata API (via Flow) requiring a Remote Site Setting
• Packaged as an unlocked package or managed package installable in any org
Key insights from the README
• Purpose: “Configure and display a datatable in a Flow screen”
• Core components:
• datatableV2 LWC (runs in Flow Screens)
• SObjectController2 Apex class (queries SObjects dynamically)
• Datatable Configuration Helper Flow (uses Metadata API to build JSON config)
• Dependencies: Flow Base Components, DualListBox component, Remote Site Setting
A. Developer & CI/CD environment (local machine)
• VS Code + Salesforce CLI
• Source repo (Git) with SFDX project
• Deployment pipeline (SFDX push or package install) → Salesforce Org
B. Salesforce Org (runtime container)
1. Lightning Experience (Browser)
– Hosts Flow screens where the LWC runs
2. UI Layer: Lightning Web Components
– datatableV2 & richDatatable
– Exposed as Flow Screen Components
3. Orchestration Layer: Salesforce Flow
– Datatable Configuration Helper & subflow
– Calls into LWC (configuration mode) & Apex (Metadata API)
4. Business Logic Layer: Apex Class (SObjectController2)
– Imperative methods & @wire adapters to execute dynamic SOQL
5. Data Layer: Salesforce Database (SObjects)
– Queried by Apex, returned as JSON to LWC
6. External Service: Metadata API endpoint
– Flow elements perform HTTP call‐out to <orgDomain>/services/Soap/m/...
– Requires Remote Site Setting
C. External Dependencies
• Flow Base Components package
• DualListBox package
Architectural patterns & design principles
• Clear separation of concerns:
• UI (LWC) ←→ service layer (Apex) ←→ data store (SObjects)
• Configuration flow decoupled from data retrieval flow
• Dynamic metadata‐driven configuration via Metadata API
• Reusable, declarative UI components for Flow screens
• Package modularity: unlocked / managed packaging