Skip to content

CRM Workflow (WFL)

Module Purpose: Implement the deterministic state machine that manages the lead lifecycle from ingestion (Email/Campaign) through to Enquiry conversion, ensuring data hygiene and automated validation.

[!TIP] Core Concept: Every lead follows a "Happy Path" or a "Terminal Path". The system ensures no lead skips the Validation Gate (CIN/PAN/GST check).


Use Case Quick Reference

ID Title Priority
US-WFL-010 Lead-to-Enquiry State Machine P0
US-WFL-011 Automated Validation Gate P0
US-WFL-012 Response Playbook Automation P1
US-WFL-013 Terminal State Triage (Barred/Fake) P1
US-WFL-014 Enquiry Pipeline Sub-statuses P1

US-WFL-010: Lead-to-Enquiry State Machine

What It Does

Implements the core logic that moves a lead through discrete stages: NewAttempting ContactContactedQualifiedEnquiry.

Who: Sales Rep, System System
When: Lead lifecycle progression

Functional Requirements

  1. State Persistence: Track the current state of every lead record in the PostgreSQL core.
  2. Transition Logic:
    • NewValidation (Automatic upon creation)
    • ValidationContacted (Triggered by manual logging of Call/Email)
    • ContactedQualified (Requires valid CIN/PAN and manual flag)
    • QualifiedEnquiry (Converts to Sales Pipeline)
  3. Draft Context: Surface the "Next Step" for the sales rep based on the current state.

US-WFL-011: Automated Validation Gate

What It Does

Automatically verifies the corporate identity of a lead using MCA and GST APIs before allowing the lead to be marked as "Qualified."

Who: System Service
When: During the Validation state

Functional Requirements

  1. API Integration: Call third-party GST/MCA verification services using the provided CIN/PAN.
  2. Hard Gate: If the API returns "Invalid" or "Inactive," the Qualified button is disabled.
  3. Status Banner: Show a "Verified" badge on the Company Master header once validation passes.

US-WFL-012: Response Playbook Automation

What It Does

Suggests specific response actions to Sales Reps based on customer interaction patterns (e.g., "Price too high," "No response post-sample").

Who: AI Assistant, Sales Rep

Functional Requirements

  1. Trigger Recognition: Staff tags an interaction with a scenario (e.g., "Price Pushback").
  2. Playbook Display:
    • Price Pushback: Show last 5 successful quotes for this product.
    • No Response: Schedule follow-up email in 48 hours.
    • COA Sent: Link the specific COA version to the next transaction.

US-WFL-013: Terminal State Triage (Barred/Fake)

What It Does

Allows users to exit the workflow for invalid leads while capturing the reason for training future AI classification models.

Functional Requirements

  1. States: Junk, Fake, Barred, Drop.
  2. Audit Note: Force a "Reason for Exit" comment before marking as terminal.
  3. AI Feedback: Feed terminal records back into the fine-tuning dataset for US-EML-002.

US-WFL-014: Enquiry Pipeline Sub-statuses

What It Does

Provides granular tracking for enquiries that have reached the Sales Pipeline but are waiting on technical or administrative dependencies.

Functional Requirements

  1. Sub-statuses:
    • Pending for Specification
    • Pending for supplier rate / RFQ
    • Make Quote
    • Long Pendancy (> 7 days)
  2. SLA Tracking: Clock starts when the sub-status is set; alerts trigger if Long Pendancy is reached.

← Back to Use Cases | ← Home