Skip to content

tcdahlberg/Quick-Inventory-Management

Repository files navigation

Quick Inventory Management

A Salesforce Lightning application for managing warehouse inventory with QR code scanning, real-time stock tracking, and a complete audit trail.

Version: 1.0.0 | API Version: 66.0 | License: BSD 3-Clause


Overview

Quick Inventory Management provides a centralized system for tracking physical goods across multiple warehouses and storage locations. Staff can scan QR codes on packages and storage locations to quickly add, remove, or transfer stock, with every transaction recorded for auditing.

Key Features

  • QR Code Scanning - Scan package and location QR codes via camera (mobile or desktop) or manual entry
  • Inventory Transactions - Add, remove, and transfer stock with full audit trail
  • Real-Time Stock Levels - Current stock rolled up from individual package quantities
  • Low Stock Alerts - Configurable thresholds per product
  • Multi-Warehouse Support - Organize storage across warehouses and locations
  • Mobile Ready - Works on desktop browsers and the Salesforce Mobile App
  • Screen Flow Integration - Reusable QR scanner component for embedding in any Screen Flow

Data Model

The application uses six custom objects:

Object Description
Warehouse__c A storage facility (e.g., warehouse, office storage room)
Storage_Location__c A specific location within a warehouse (e.g., Shelf A1, Cabinet 3)
Product__c A product SKU with stock levels, type, and low-stock threshold
Package__c A single box/container of a product with its own QR code
Inventory_Transaction__c An audit record of an add, remove, or transfer action
Inventory_Transaction_Line_Item__c Per-package quantity changes within a transaction

Relationships

Warehouse__c
  └── Storage_Location__c (Master-Detail)
        └── Package__c.Location__c (Lookup)

Product__c
  └── Package__c.Product__c (Lookup)
  └── Inventory_Transaction__c.Product__c (Lookup)

Inventory_Transaction__c
  └── Inventory_Transaction_Line_Item__c (Master-Detail)
        └── Package__c (Lookup)

Key Automations

  • Package creation auto-populates quantities from the parent Product's Quantity_Per_Box__c
  • Transaction line item creation auto-updates the Package's Current_Quantity__c
  • Package Status is a formula: Unopened, Partially Used, or Depleted
  • Product Current Stock rolls up from all related Package quantities

Components

Lightning Web Components

Component Type Description
inventoryScanner App/Home/Record Page Standalone inventory scanner with session management, search, and add/remove/transfer actions
qrScannerEngine Internal (not exposed) Reusable scanning engine supporting mobile native scanner, desktop camera (jsQR), and manual input
qrScannerFlow Screen Flow Flow-embeddable scanner that outputs a scanned record ID as a flow variable

Apex Classes

Class Description
InventoryController Main controller for QR lookups, transactions, stock summaries, and search
InventoryTransactionHandler Trigger handler that updates Package quantities on line item insert
PackageHandler Trigger handler that auto-populates Package quantities from Product on creation
InventoryController_TEST Comprehensive test class covering all controllers and handlers

Permission Sets

Permission Set Description
Quick Inventory Admin Full CRUD on all inventory objects, manage warehouses and products
Quick Inventory User Scan QR codes, create transactions, update packages; read-only on reference data

Quick Start

Prerequisites

  • Salesforce org with Dev Hub enabled (for scratch org development)
  • CumulusCI installed (pip install cumulusci)
  • Salesforce CLI installed
  • Node.js installed (for Jest tests)

Setup

# 1. Clone the repository
git clone https://github.com/your-org/Quick-Inventory-Management.git
cd Quick-Inventory-Management

# 2. Install Node.js dependencies
npm install

# 3. Connect your Dev Hub (first time only)
cci org connect --org dev_hub

# 4. Create a scratch org with all metadata deployed
cci flow run dev_org --org dev

# 5. Open the org
cci org browser dev

First Use

  1. Open the Quick Inventory app from the App Launcher
  2. Navigate to Products and create a product (e.g., "Fall 2026 Magazine")
  3. Navigate to Warehouses and create a warehouse with storage locations
  4. Create Packages for your product (quantities auto-populate)
  5. Print QR codes from Package and Storage Location record pages
  6. Use the Inventory Scanner on the home page to scan and manage stock

Documentation

Document Description
Quick Start Guide Get up and running in minutes
User Guide Complete end-user instructions
Developer Setup Development environment and workflows
Contributing How to contribute to the project
Changelog Version history and release notes
User Story Original requirements and user story

Development

Common Commands

# Deploy all changes
cci task run deploy --path force-app --org dev

# Deploy only LWC
cci task run deploy --path force-app/main/default/lwc --org dev

# Deploy only Apex
cci task run deploy --path force-app/main/default/classes --org dev

# Run Apex tests
cci task run run_tests --org dev

# Run LWC Jest tests
npm test

# Run Jest tests with coverage
npm test -- --coverage

# Open the scratch org
cci org browser dev

# Delete and recreate scratch org
cci org scratch_delete dev
cci flow run dev_org --org dev

Project Structure

Quick-Inventory-Management/
├── cumulusci.yml                  # CumulusCI configuration
├── sfdx-project.json              # Salesforce DX project config
├── package.json                   # Node.js dependencies (Jest, ESLint, Prettier)
├── eslint.config.js               # ESLint configuration
├── jest.config.js                 # Jest configuration
├── CHANGELOG.md                   # Version history
├── CONTRIBUTING.md                # Contribution guidelines
├── LICENSE.md                     # BSD 3-Clause License
├── config/
│   └── project-scratch-def.json   # Scratch org definition
├── docs/                          # Documentation
├── force-app/main/default/
│   ├── applications/              # Quick Inventory Lightning app
│   ├── classes/                   # Apex controllers, handlers, tests
│   ├── flexipages/                # App home page layout
│   ├── lwc/                       # Lightning Web Components
│   │   ├── inventoryScanner/      # Standalone scanner component
│   │   ├── qrScannerEngine/       # Reusable scanning engine
│   │   └── qrScannerFlow/         # Screen Flow scanner variant
│   ├── objects/                   # Custom object metadata
│   ├── permissionsets/            # Permission sets
│   ├── staticresources/           # jsQR library
│   ├── tabs/                      # Custom tabs
│   └── triggers/                  # Apex triggers
└── orgs/                          # Org-specific configurations

Testing

Apex Tests

The project requires 75% minimum code coverage (configured in cumulusci.yml).

# Run all Apex tests via CumulusCI
cci task run run_tests --org dev

# Run specific test class via SF CLI
sf apex run test --class-names InventoryController_TEST --target-org Quick-Inventory-Management__dev --result-format human --code-coverage --wait 20

LWC Jest Tests

# Run all Jest tests
npm test

# Run with coverage report
npm test -- --coverage

# Run specific component tests
npm test -- qrScannerEngine

Code Quality

The project uses ESLint, Prettier, and Husky pre-commit hooks:

# Lint JavaScript
npm run lint

# Format all files
npm run prettier

# Check formatting
npm run prettier:verify

License

BSD 3-Clause License. See LICENSE.md for details.

Copyright (c) 2026, Thad Dahlberg. All rights reserved.

About

A Salesforce Lightning application for managing warehouse inventory with QR code scanning, real-time stock tracking, and a complete audit trail.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors