product-category-viewer
v1.0.1
Published
Visualize Salesforce ProductCategory hierarchies with an interactive tree view
Maintainers
Readme
ProductCategory Viewer 🏷️
A beautiful CLI tool to visualize Salesforce ProductCategory hierarchies in an interactive tree view.
Features
- 🌳 Interactive Tree View - Expandable/collapsible hierarchy visualization
- 🎨 Dark Theme UI - Modern Tailwind CSS dark theme
- 📊 Statistics Dashboard - Total, root, child counts, and max depth
- 🔍 Real-time Search - Filter categories by name or code
- 📋 Detailed View - Side panel with complete category information
- 🏷️ Visual Badges - Quick identification of navigational categories and product counts
- ⚡ Fast Performance - Efficient tree rendering with thousands of categories
Prerequisites
- Node.js (v14 or higher)
- Salesforce CLI (
sf) - Access to a Salesforce org with ProductCategory, ProductCatalog data
Installation
Global Installation (Recommended)
npm install -g product-category-viewerUsage
Start the Viewer
# Using the full command
product-category-viewer start -u [email protected]
# Using the short alias
pcv start -u myalias
# With custom port
product-category-viewer start -u [email protected] --port 8080Command Options
Options:
-u, --username <username> Salesforce username or alias (required)
-p, --port <number> Port to run the server on (default: 3000)
-h, --help Display help for commandHow It Works
- Fetches Data - Queries all ProductCategory records from your Salesforce org
- Queries all ProductCatalog records from your Salesforce org
- Builds Hierarchy - Constructs parent-child relationships using
ParentCategoryId - Launches Server - Starts a local web server with the interactive UI
- Opens Browser - Navigate to
http://localhost:3000to explore
Features Explained
Tree View
- Expand/Collapse - Click on any category to show/hide children
- Expand All / Collapse All - Bulk operations for entire tree
- Visual Hierarchy - Indentation and lines show relationships
Search
- Real-time filtering by category name or code
- Highlights matching categories
- Maintains tree structure
Details Panel
- Click "Details" button on any category
- View all fields including:
- Name, Code, Description
- IDs (Category, Parent, Catalog)
- Product count and sort order
- Navigational status
- Timestamps
Statistics
- Total Categories - All categories in the org
- Root Categories - Categories without parents
- Child Categories - Categories with parents
- Max Depth - Deepest level in the hierarchy
SOQL Query
The tool executes these SOQL queries:
SELECT
CatalogId, Code, CreatedById, CreatedDate,
Description, Id, IsDeleted,
IsNavigational, LastModifiedById, LastModifiedDate,
LastReferencedDate, LastViewedDate, Name,
NumberOfProducts, ParentCategoryId,
SortOrder, SystemModstamp
FROM ProductCategory
SELECT
CatalogType, Code, CreatedById, CreatedDate,
Description, EffectiveEndDate, EffectiveStartDate, Id, IsDeleted, LastModifiedById, LastModifiedDate, LastReferencedDate, LastViewedDate, Name, NumberOfCategories, OwnerId, SystemModstamp
FROM ProductCatalog
UI
Main View
- Dark themed interface
- Statistics cards at the top
- Search bar and controls
- Expandable tree view
Details Panel
- Slides in from the right
- Shows all category fields
- Formatted dates and IDs
- Visual indicators for boolean fields
Troubleshooting
"Salesforce CLI not found"
Ensure sf CLI is installed and in your PATH:
sf --version"Query failed"
- Check that your username/alias is correct
- Verify you have access to ProductCategory object
- Ensure you're authenticated:
sf org list
Port Already in Use
Use a different port:
product-category-viewer start -u myorg -p 8080No Categories Found
- Verify ProductCategory records exist in your org
- Check object permissions
- Try running the SOQL query manually:
sf data query -q "SELECT Id, Name FROM ProductCategory" -o yourorg
Browser Compatibility
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
Performance
- Handles thousands of categories efficiently
- Lazy rendering for large trees
- Minimal memory footprint
- Fast search and filtering
Roadmap
- [ ] Export tree to JSON/CSV
- [ ] Print/PDF export
- [ ] Drag-and-drop to reorganize (read-only preview)
- [ ] Filter by catalog
- [ ] Show product details inline
- [ ] Color-code by depth level
- [ ] Breadcrumb navigation
- [ ] Keyboard shortcuts
License
MIT (c) Mohan Chinnappan
Note: This tool provides a read-only view of your ProductCategory data. It does not modify any Salesforce records.
