Lookups Page
Cross-system data validation tools for debugging sync issues and verifying data consistency between Business Central, middleware database, and e-commerce platforms.
Overview
The Lookups page provides four specialized tools to compare data across all three systems in your sync architecture:
- Business Central (BC) - Source of truth for inventory, orders, and tracking
- Middleware Database - Intermediate sync database (rm_* tables)
- CMS Platform - BigCommerce or WooCommerce storefront
Each lookup tool queries all relevant systems and highlights discrepancies, making it easy to identify where sync issues occur.
Access: GSM Middleware → Tools → Lookups
Permission Required: manage_gsm_middleware
Lookup Tools
1. Order Lookup
Purpose: Compare a single order across all systems to identify data mismatches
Use when:
- Customer reports incorrect order details
- Order stuck in sync queue
- BC shows different data than storefront
- Debugging order import issues
Interface
Inputs:
- Site: Select site from dropdown (all active sites)
- Order Number: Enter full order number (e.g.,
SITE-12345)
Button: "Lookup Order"
Results Display
Status Badge:
- ✅ "No differences found" — Data matches across systems
- ⚠️ "X Differences Found" — Mismatches detected
Differences Table
Shows when mismatches detected:
| Column | Description | Example |
|---|---|---|
| Field | What data differs | total_price |
| Middleware | Value in MW database | $149.99 |
| CMS | Value on platform | $139.99 |
| Severity | Issue severity level | 🔴 Critical |
Severity levels:
- 🔴 Critical — Data mismatch affecting fulfillment (e.g., address, items)
- 🟡 Warning — Minor difference (e.g., date format, rounding)
- ℹ️ Info — Informational only (e.g., timestamps)
System Panels
Expandable JSON views:
Middleware Database Panel:
- Shows complete rm_order record
- Includes line items (rm_lineitems)
- Shows address (rm_address)
- Click to expand/collapse JSON
CMS Platform Panel:
- Shows API response from BigCommerce or WooCommerce
- Full order object including products, customer, totals
- Click to expand/collapse JSON
Line Items Table:
- Displays all products in order with SKU, quantity, price
- Data from middleware database
Example Use Case
Scenario: Customer says they ordered 2 units but only received invoice for 1
Steps:
- Select customer's site
- Enter order number
- Click "Lookup Order"
- Check Differences Table:
- Field:
line_item_qty - Middleware:
2 - CMS:
1 - Severity: Critical
- Field:
- Expand CMS Panel to see API response
- Verify: Storefront has wrong quantity, MW is correct
- Fix: Manually update storefront order via admin panel
2. Order Status Lookup
Purpose: Quick order status check without email requirement (mirrors customer widget)
Use when:
- Quick status check for customer service
- Verifying tracking was pushed to BC
- Checking shipment dates
- Debugging order status widget issues
Interface
Inputs:
- Order Number: Enter order number (no email required)
Button: "Lookup Order Status"
Results Display
Header:
- Order number
- Status badge (color-coded):
- 🟢 SHIPPED — Order fully shipped
- 🟢 COMPLETED — Order completed
- 🟠 PROCESSING — Order in progress
- 🔴 NOT FOUND — Order doesn't exist
Customer Card:
- Customer name
- Email address (clickable mailto link)
- City, State, ZIP
Shipments Table (from Middleware):
| Column | Description | Example |
|---|---|---|
| Tracking # | Tracking number | 1Z999AA10123456789 |
| Carrier | Shipping provider | UPS |
| SKUs | Products in shipment | SKU1, SKU2 |
| Date | Shipment date | 2024-12-15 10:30 |
Shows all shipments from shipments table (middleware).
Business Central Tracking Table:
| Column | Description | Example |
|---|---|---|
| Tracking # | Tracking number | 1Z999AA10123456789 |
| Carrier | Carrier code | FEDEX |
| Item | Product SKU | WIDGET-001 |
| Qty | Quantity shipped | 2 |
Shows BC tracking data (retrieved via BC API integration).
Example Use Case
Scenario: Customer asking "Where's my order?"
Steps:
- Enter order number in tool
- Click "Lookup Order Status"
- See status: SHIPPED 🟢
- View Shipments table:
- Tracking:
1Z999AA10123456789 - Carrier:
UPS - Date:
2024-12-10
- Tracking:
- Copy tracking number and email customer
3. Inventory Lookup
Purpose: Compare inventory quantities across BC, middleware, and CMS for multiple SKUs
Use when:
- Debugging "out of stock" issues
- Verifying inventory sync working
- Checking why product shows wrong quantity
- Auditing inventory accuracy
Interface
Inputs:
- Site: Select site from dropdown
- SKUs: Comma-separated SKU list (e.g.,
SKU1, SKU2, SKU3)
Button: "Lookup Inventory"
Results Display
Summary Stats:
| Stat | Description | Example |
|---|---|---|
| Checked | How many SKUs queried | 10 |
| In Sync | SKUs matching across all 3 systems | 8 |
| Out of Sync | SKUs with mismatches | 2 |
Filter Buttons:
- All — Show all checked SKUs
- Out of Sync (X) — Show only mismatches
- In Sync (X) — Show only matching SKUs
Useful for focusing on problems when checking large SKU lists.
Inventory Comparison Table:
| Column | Description | Example |
|---|---|---|
| SKU | Product SKU | WIDGET-001 |
| BC Qty | Business Central quantity | 500 |
| BC Status | BC product status | Active |
| MW Qty | Middleware database quantity | 450 |
| MW Last Sync | Last sync timestamp | 2024-12-15 10:30 |
| CMS Qty | Storefront quantity | 450 |
| BC↔MW | Difference between BC and MW | +50 |
| MW↔CMS | Difference between MW and CMS | 0 |
| Status | Sync status | ✅ In Sync / ❌ Mismatch |
Row highlighting:
- ⚠️ Yellow background — Out of sync (mismatch detected)
- No highlighting — In sync (all systems match)
Difference cells:
+50— CMS has 50 more than MW-20— CMS has 20 less than MW0— Perfect match—— Data unavailable in one system
Example Use Case
Scenario: Product showing "Out of Stock" on website but BC shows 100 units available
Steps:
- Select site
- Enter SKU:
WIDGET-001 - Click "Lookup Inventory"
- Read results table:
- BC Qty:
100 - MW Qty:
0 - CMS Qty:
0 - BC↔MW:
+100(BC has 100 more than MW) - Status: ❌ Mismatch
- BC Qty:
- Diagnosis: Inventory sync from BC → MW failed
- Fix: Check inventory sync health check, run manual sync, verify cron job
4. Tracking Lookup
Purpose: Compare tracking/shipment data across BC, middleware, and CMS for an order
Use when:
- Tracking not showing on storefront
- BC shows shipment but customer doesn't see it
- Debugging tracking sync issues
- Verifying which system has tracking data
Interface
Inputs:
- Site: Select site from dropdown
- Order Number: Enter order number
Button: "Lookup Tracking"
Results Display
Summary Stats:
| Stat | Description | Example |
|---|---|---|
| Total Tracking Numbers | Unique tracking numbers found | 2 |
| Fully Synced | Tracking in all 3 systems | 1 |
| Partial/Missing | Tracking missing from one+ system | 1 |
Tracking Comparison Table:
| Column | Description | What It Shows |
|---|---|---|
| Tracking Number | Shipment tracking ID | 1Z999AA10123456789 |
| In BC | Found in Business Central | ✅ (expandable JSON) |
| In Middleware | Found in shipments table | ✅ (expandable JSON) |
| In CMS | Found on storefront | ❌ Not found |
| Status | Sync status | ⚠️ Partial |
Status badges:
- ✅ Fully Synced — Tracking in all 3 systems
- ⚠️ Partial — Missing from one or more systems
System cells:
- ✅ Green checkmark — Data found (click to expand JSON)
- ❌ Red X — Data not found
Tracking Detail Sections:
Expandable panels showing full JSON from each system:
- Business Central — BC API response
- Middleware —
shipmentstable row - CMS — Platform API response
Click "▸ Full Details" to expand.
Example Use Case
Scenario: Customer says tracking link not working on order confirmation page
Steps:
- Select site
- Enter order number
- Click "Lookup Tracking"
- View table results:
- Tracking:
1Z999AA10123456789 - In BC: ✅
- In Middleware: ✅
- In CMS: ❌
- Status: ⚠️ Partial
- Tracking:
- Diagnosis: Tracking sync from MW → CMS failed
- Fix: Check tracking sync toggle in site settings, verify API credentials, run manual sync
Common Workflows
Debugging "Order Not Syncing"
Goal: Find where order sync is failing
Steps:
- Go to Order Lookup tab
- Enter site and order number
- Check results:
- Found in MW but not CMS? → Order sync MW → CMS failed
- Not found in MW? → Order sync CMS → MW failed
- Found in both but differences? → Data transformation issue
- Review Differences Table for specific fields
- Check action log in Orders page for error messages
- Verify API credentials in site settings
Verifying Inventory Sync Health
Goal: Confirm inventory sync is working correctly
Steps:
- Go to Inventory Lookup tab
- Select site
- Enter 10-20 popular SKUs (comma-separated)
- Click "Lookup Inventory"
- Review summary stats:
- In Sync > 95%? → Sync healthy
- Out of Sync > 5%? → Investigate issues
- Click "Out of Sync" filter button
- Review MW Last Sync column:
- Recent timestamps? → Sync running but data mismatching
- Old timestamps? → Sync may be stopped
- Check Control Panel → Inventory health check
Pre-Launch Site Validation
Goal: Ensure new site sync working before going live
Steps:
- Create test order on new site
- Use Order Lookup to verify:
- Order appears in MW database
- Data matches between CMS and MW
- Use Inventory Lookup with 5-10 SKUs:
- Verify all show "In Sync"
- Use Tracking Lookup with test order (after creating test shipment in BC):
- Verify tracking appears in all 3 systems
- Use Order Status Lookup to verify customer widget works
- If all lookups pass → Site ready for launch
Monthly Data Audit
Goal: Proactive check for sync drift
Steps:
- For each site:
- Run Inventory Lookup on 20+ SKUs
- Record "Out of Sync" percentage
- If any site > 5% out of sync:
- Check inventory sync health
- Review recent errors in debug.log
- Run manual sync if needed
- Verify 5-10 recent orders with Order Lookup
- Document any persistent issues for investigation
Technical Details
API Endpoints
Base: /wp-json/gsm-middleware/v1/
| Endpoint | Method | Parameters | Description |
|---|---|---|---|
/lookups/order | GET | site_id, order_number | Compare order data |
/lookups/inventory | GET | site_id, skus (comma-separated) | Compare inventory |
/lookups/tracking | GET | site_id, order_number | Compare tracking |
/lookups/order-status | GET | order_number | Get order status |
Authentication: WordPress REST API nonce (auto-handled by @wordpress/api-fetch)
Controller: src/API/Lookups_REST_Controller.php
Data Sources
| Lookup | Middleware DB | Business Central API | Platform API |
|---|---|---|---|
| Order | rm_order, rm_lineitems, rm_address | Order API | Orders endpoint |
| Order Status | shipments, rm_order | Tracking API | Shipments endpoint |
| Inventory | rm_items | Inventory API | Products endpoint |
| Tracking | shipments | Tracking API | Shipments endpoint |
React Components
Main Component: assets/js/pages/LookupsPage.jsx (tab container)
Sub-components:
OrderLookup.jsx— Order comparison toolOrderStatusLookup.jsx— Status widget mirrorInventoryLookup.jsx— Inventory comparison toolTrackingLookup.jsx— Tracking comparison tool
State Management: React hooks (useState, useCallback)
API Client: assets/js/api/lookups.js (wrapper functions)
Troubleshooting
"Request failed" Error
Cause: Network error, API timeout, or permission issue
Solution:
- Check browser console for detailed error
- Verify user has
manage_gsm_middlewarecapability - Check
wp-content/debug.logfor PHP errors - Test REST API directly:
curl -X GET "https://site.com/wp-json/gsm-middleware/v1/lookups/order?site_id=1&order_number=SITE-123" \
-H "X-WP-Nonce: YOUR_NONCE"
Order/SKU "Not Found" in All Systems
Cause: Order/product doesn't exist or wrong site selected
Solution:
- Verify order number is correct (check case-sensitivity)
- Confirm correct site selected in dropdown
- Check Orders/Items page to verify order/SKU exists in MW
- Query database directly:
SELECT * FROM rm_order WHERE number = 'SITE-12345';
SELECT * FROM rm_items WHERE sku = 'WIDGET-001';
Inventory Shows "-" (Dash) for BC or CMS
Cause: API connection failed or SKU not found in that system
Solution:
- Check API credentials in site settings
- Verify SKU exists in BC/platform:
- BC: Check Business Central directly
- CMS: Check product admin page
- Review API error logs:
tail -100 wp-content/debug.log | grep -i api - Test API connection manually from Testing Tools
Tracking Shows "Partial" Status
Cause: Tracking sync incomplete (normal during sync delay)
Solution:
- Wait 5-10 minutes and re-check (cron may be running)
- Check tracking sync toggle enabled in site settings
- Check tracking sync health check in Control Panel
- Review tracking sync logs:
tail -100 wp-content/debug.log | grep tracking - Manually trigger sync if needed (Testing Tools page)
Large SKU List Causes Timeout
Cause: Too many SKUs queried at once (API rate limits)
Solution:
- Break SKU list into smaller batches (10-20 SKUs max)
- Run sequential lookups instead of one large query
- Increase PHP
max_execution_timefor admin users (in wp-config.php):if ( is_admin() && current_user_can( 'manage_gsm_middleware' ) ) {
set_time_limit( 120 );
}
Related Documentation
- Orders Page — Order management and errors
- Items Page — Inventory management
- Control Panel — Sync health checks
- Database Schema — Table reference
- API Reference — REST API details
- Testing Tools — Manual sync triggers
Best Practices
- Start with Order Lookup when debugging order issues (most comprehensive)
- Use Inventory Lookup with "Out of Sync" filter for large SKU audits
- Bookmark Lookups page for quick customer service access
- Document patterns - If you see same difference repeatedly, may indicate systemic issue
- Combine with Control Panel - Check health status before running lookups
- Use Order Status for customers - Quick, non-technical status view
- Export lookup results - Take screenshots or copy JSON for support tickets
- Regular audits — Run monthly inventory lookups to catch drift early