CRM Master Use Cases (CRM)¶
Module Purpose: Custom CRM system for company master data management, replacing D365 with flexible multi-location tracking, social media integration, vendor empanelment workflows, and AI-powered insights for chemical distribution operations.
Use Case Quick Reference¶
| ID | Title | Priority |
|---|---|---|
| US-CRM-001 | Create Company Record | P1 |
| US-CRM-002 | Manage Company Information Tabs | P1 |
| US-CRM-003 | Add Social Media Channels | P1 |
| US-CRM-004 | Track Multi-Location Customers | P1 |
| US-CRM-005 | Manage Vendor Empanelment (FEP) | P1 |
| US-CRM-006 | Track Department-Wise Contacts | P1 |
| US-CRM-007 | Track Content Broadcasts | P2 |
| US-CRM-008 | Track Products Purchased | P2 |
| US-CRM-009 | Track Competitor Suppliers | P2 |
| US-CRM-010 | Track Agents/Brokers | P2 |
| US-CRM-011 | Track Employee Accountability | P1 |
| US-CRM-012 | Add Customer Comments | P2 |
| US-CRM-013 | Migrate D365 Customer Data | P1 |
| US-CRM-014 | Dashboard Metrics Overview | P1 |
| US-CRM-015 | AI Assistant for Customer Queries | P0 |
| US-CRM-016 | Advanced Search & Filters | P0 |
| US-CRM-017 | Activity Timeline View | P1 |
| US-CRM-018 | Bulk Operations | P2 |
| US-CRM-019 | Audit Trail Viewer | P2 |
| US-CRM-020 | Notifications & Alerts | P2 |
| US-CRM-021 | Document Repository with OCR | P0 |
| US-CRM-022 | Duplicate Detection | P0 |
| US-CRM-023 | Quick Actions & Keyboard Shortcuts | P2 |
| US-CRM-024 | Export & Reporting | P2 |
| US-CRM-025 | Mobile Responsive Views | P2 |
| US-CRM-026 | Role-Based Dashboards | P1 |
| US-CRM-027 | Customer Risk Scoring | P3 |
| US-CRM-028 | Voice Input & Dictation | P3 |
| US-CRM-029 | Input Format Validation | P1 |
| US-CRM-030 | GST/PAN Validation with Government API | P1 |
| US-CRM-031 | Credit Limit Business Rules | P1 |
| US-CRM-032 | FEP Workflow State Validation | P1 |
| US-CRM-033 | Date Field Validation | P2 |
| US-CRM-034 | Migrate D365 Transaction History | P1 |
| US-CRM-035 | Migrate D365 Document Attachments | P1 |
| US-CRM-036 | D365 Custom Field Discovery & Mapping | P0 |
| US-CRM-037 | Post-Migration Data Reconciliation | P1 |
| US-CRM-038 | D365 Bi-Directional Sync (Transition) | P2 |
| US-CRM-039 | Migrate D365 User Roles & Permissions | P2 |
| US-CRM-040 | Migrate D365 Activity Timeline | P3 |
Priority Legend: P0 = High Priority (Differentiator), P1 = MVP Core, P2 = Phase 2, P3 = Future Enhancement
US-CRM-001: Create Company Record¶
Purpose: Enable sales reps to create new company records with basic information, cascading address dropdowns, and multi-value communication fields to start tracking potential customers.
| Property | Value |
|---|---|
| Actor | Sales Rep, Sales Manager |
| Trigger | User clicks "Add Customer" button |
| Preconditions | - User authenticated with CRM access - Country/State/City master data populated |
| Priority | P1 |
Main Success Scenario¶
- Form Display
- User clicks "Add Customer" from main interface
-
System displays company creation form with fields: Company Name, Address (Country/State/City cascading dropdowns), Mobile (4 fields), Email (3 fields), Website, SAP Code
-
Cascading Address Selection
- User selects Country from dropdown
- System auto-populates State dropdown with states for selected country
- User selects State
-
System auto-populates City dropdown with cities for selected state
-
Data Entry
- User enters Company Name, at least 1 mobile number, primary email
- User optionally fills additional mobile/email fields
-
System validates email format on blur, phone format (10 digits for India)
-
Record Creation
- User clicks "Save"
- System validates required fields (Company Name, Country, at least 1 mobile)
- System generates unique Customer ID (UUID)
- System creates Company record with status = "Active"
- System displays success message: "Company created successfully"
- System redirects to Company detail view (8-tab interface)
Alternative Flows¶
A1: Duplicate Company Name - At step 4, if Company Name matches existing record (fuzzy match >80%) - System displays warning: "Similar company exists: [Name] (SAP Code: [Code])" - User can click "View Existing" or proceed with "Create Anyway"
A2: Invalid GST Format - During data entry, if user enters GST number - System validates format: 15 alphanumeric characters - If invalid, inline error: "Invalid GST format" - Form submit blocked until corrected
See full acceptance criteria in PRD: US-CRM-001
US-CRM-015: AI Assistant for Customer Queries¶
Purpose: Provide natural language query interface for CRM data, enabling users to ask questions like "Show me all customers in Maharashtra with credit limit > 10L" and get instant results without complex filtering.
| Property | Value |
|---|---|
| Actor | Any CRM user (Sales Rep, Manager, Admin) |
| Trigger | User types question in AI Assistant input box OR user clicks floating AI button |
| Preconditions | - AI model configured (Ollama or OpenAI) - User has permissions to view customer data - Customer database populated |
| Priority | P0 (High Priority - Differentiator) |
Main Success Scenario¶
- Query Input
- User clicks floating AI Assistant button (available on every page)
- System displays input box: "Ask about customers, products, or relationships..."
-
User types: "Show me all customers in Maharashtra with credit limit > 10L"
-
Natural Language Processing
- System passes query to AI model
- AI parses intent:
filter_customers(state="Maharashtra", credit_limit>1000000) -
AI generates SQL or Django ORM query
-
Query Execution
- System executes query against Company table
- System applies user's permission filters (Sales Rep sees only assigned customers)
-
Results returned: 47 customers
-
Results Display
- System displays results in table format:
- Columns: Company Name, SAP Code, City, Credit Limit, Assigned To
- Sortable, clickable rows
-
AI suggests follow-up questions:
- "Show FEP status for these customers"
- "Which of these have no activity in 90 days?"
-
Audit Logging
- System logs AI query:
{user_id, query_text, results_count, timestamp} - Used for training and compliance
Alternative Flows¶
A1: Ambiguous Query - At step 2, if AI cannot parse intent - System responds: "I didn't understand. Did you mean: [Suggestion 1] or [Suggestion 2]?" - User selects suggestion or rephrases
A2: No Results Found - At step 3, if query returns 0 results - System displays: "No customers match your query. Try: [Alternative Query]"
See full acceptance criteria in PRD: US-CRM-015
US-CRM-022: Duplicate Detection¶
Purpose: Prevent duplicate customer creation by performing fuzzy matching on Company Name and exact matching on GST/PAN, with warnings and override capabilities for data quality.
| Property | Value |
|---|---|
| Actor | Sales Rep, System De-duplication Engine |
| Trigger | User enters Company Name OR GST/PAN during company creation |
| Preconditions | - Customer master database populated - Fuzzy match service configured |
| Priority | P0 (High Priority) |
Main Success Scenario¶
- Company Name Entry
- User types Company Name: "ABC Chemicals Pvt Ltd"
-
System triggers fuzzy match on blur (after user leaves field)
-
Fuzzy Matching
- System compares against existing Company table
- Fuzzy match algorithm calculates similarity score
-
Match found: "ABC Chemicals Private Limited" (85% similarity)
-
Duplicate Warning
- System displays warning banner:
- "⚠️ Similar company exists: ABC Chemicals Private Limited (SAP Code: CUST-00123)"
- Buttons: [View Existing] [Create Anyway]
- User clicks [View Existing]
- System opens existing company record in new tab
- User verifies it's the same company
-
User cancels creation
-
Audit Trail
- System logs duplicate prevention:
{user_id, attempted_name, matched_name, action="aborted"}
Alternative Flows¶
A1: User Overrides Warning
- At step 3, user clicks [Create Anyway]
- System logs override: {user_id, matched_name, override_reason=null}
- Warning appears in Audit Trail Viewer for compliance review
A2: GST Exact Match - During data entry, user enters GST: "27AAAAA1234A1Z5" - System performs exact match (100% match required) - If match found: System blocks creation with error: "🛑 Duplicate GST - Company already exists: [Name]" - User cannot override (Admin approval required)
See full acceptance criteria in PRD: US-CRM-022
US-CRM-030: GST/PAN Validation with Government API¶
Purpose: Validate GST and PAN numbers against government APIs to prevent fraudulent entities, with fallback to format-only validation if APIs unavailable.
| Property | Value |
|---|---|
| Actor | Compliance Officer, System Validation Service |
| Trigger | User enters GST or PAN number in Company form |
| Preconditions | - GSTIN Verification API configured - PAN validation regex defined - Rate limiting configured (avoid API quota exhaustion) |
| Priority | P1 |
Main Success Scenario¶
- GST Entry
- User enters GST: "27AAAAA1234A1Z5"
-
System waits for blur event (user leaves field)
-
API Validation
- System calls GSTIN Verification API:
GET /verify?gstin=27AAAAA1234A1Z5 -
API returns:
{ "valid": true, "legal_name": "ABC Chemicals Private Limited", "business_type": "Private Limited Company", "registration_date": "2020-05-15" } -
Success Feedback
- System displays green checkmark: "Verified ✓"
- System auto-fills Company Name field with "ABC Chemicals Private Limited" (if empty)
-
System stores API response in metadata field
-
PAN Entry
- User enters PAN: "ABCDE1234F"
- System validates format:
[A-Z]{5}[0-9]{4}[A-Z]{1} -
Format valid: Green checkmark displayed
-
Audit Logging
- System logs validation:
{field="GST", value="27...", api_status="verified", legal_name="ABC..."}
Alternative Flows¶
A1: API Timeout - At step 2, if API call takes >5 seconds - System skips API validation, performs format-only check - Yellow warning: "⚠️ Could not verify with government API - format validated only" - User can proceed
A2: Invalid GST
- At step 2, if API returns {valid: false}
- System displays red error: "✗ Invalid GST - not found in government records"
- System blocks save with error message: "Invalid GST/PAN. Cannot proceed."
- User must correct or leave blank
See full acceptance criteria in PRD: US-CRM-030
Remaining Use Cases¶
For detailed specifications of all 40 use cases (UC-CRM-001 through UC-CRM-040), including:
- Company Master CRUD (CRM-001 to CRM-013)
- Dashboard & Analytics (CRM-014, CRM-026, CRM-027)
- AI & Automation (CRM-015, CRM-021, CRM-022, CRM-028)
- Search & Discovery (CRM-016, CRM-017, CRM-023)
- Bulk Operations (CRM-018, CRM-024)
- Audit & Compliance (CRM-019, CRM-029, CRM-030, CRM-031, CRM-032, CRM-033)
- Notifications (CRM-020, CRM-025)
- D365 Migration (CRM-013, CRM-034, CRM-035, CRM-036, CRM-037, CRM-038, CRM-039, CRM-040)
See the complete CRM Master PRD with: - 40 user stories with acceptance criteria - Database schema (Company, Location, Contact, ContentBroadcast, Transaction, Document tables) - Comprehensive D365 migration strategy - Technical architecture (Django + PostgreSQL) - Success metrics
Cross-Module Dependencies¶
Integrates With¶
- US-PRE-004: De-duplication Logic – Prelead matching uses CRM customer master
- US-EML-013: Multi-Entity Validation – CIN/PAN validation reused in CRM
- US-MST-001: Entity Hierarchies – Company → Location → Contact hierarchy
- US-PLN-002: Card Metadata – CRM data populates Kanban cards
Provides Data To¶
- Sales Follow-up module (customer assignments)
- Quotation & Costing module (customer-specific pricing)
- Operations & Logistics (delivery locations from CRM multi-location tracking)
Technical Architecture¶
Backend: Django 4.2+ with PostgreSQL 14+
Frontend: React/Next.js with Server-Side Rendering
AI Engine: Ollama (local) or OpenAI API
OCR: Tesseract or AWS Textract
Authentication: Django Auth with role-based permissions
Key Design Patterns: - Enterprise Context Layer: Universal Context Container for company data (see Architectural Patterns) - Precedent Engineering: AI-extracted decision traces for customer negotiations - Activity-Stream Engineering: Immutable event log of all customer interactions