Skip to Content
SahajFlowHelp Center
Product

Business workflows

Purpose: the cross-module journeys that matter, as implemented. Each states the starting point, the state changes, who does what, what is automatic, and how it fails.

Automated steps run in the backend (and sometimes in a background worker). "Manual" means a person must click an action.

For step-by-step process guides, see Workflow guides: lead conversion, quote to invoice, invoice to payment, project delivery, procure to pay, and how stock becomes available.


1. Enquiry to cash

Starting point. A lead exists — typed in, captured by a public lead form, or imported from CSV.

#StepWhoState changeManual/Auto
1Lead createdUSER+Lead NEWManual (or automatic from a form submission)
2Work the lead; log calls/notes; send emailUSER+Status CONTACTED/QUALIFIEDManual
3Associate the lead with an account (or let conversion create one)USER+lead.company setManual
4Convert leadOWNER/ADMIN (crm.lead.convert)Lead CONVERTED + converted_at; Opportunity created and linked one-to-one; account created or reusedManual, single transaction
5Move the opportunity through pipeline stagesOWNER/ADMIN (crm.opportunity.move_stage)Opportunity stage/pipelineManual
6Create a quote for the opportunityUSER+Quote DRAFT, QT-YYYY-…Manual
7Send the quoteOWNER/ADMIN (q2c.quote.send)SENT + sent_atManual
8Customer decidesOWNER/ADMINACCEPTED / REJECTED, or EXPIRED after valid_untilManual (expiry automatic)
9Convert accepted quoteOWNER/ADMIN (q2c.quote.convert)Sales order DRAFT, SO-YYYY-…, snapshots quote dataManual, quote locked
10Confirm the orderOWNER/ADMIN (q2c.sales_order.confirm)CONFIRMED + confirmed_atManual
11Convert confirmed orderOWNER/ADMIN (q2c.sales_order.convert)Invoice DRAFT, INV-YYYY-…, snapshots order dataManual, one invoice per order
12Issue the invoiceOWNER/ADMIN (q2c.invoice.issue)ISSUED + issued_atManual
13Record paymentOWNER/ADMIN (q2c.payment.record)ISSUED → PARTIALLY_PAID → PAID; amount_paid recomputedManual, invoice row locked
14Correct a paymentOWNER/ADMINREVERSED/CANCELLED payment; invoice balance restoredManual, same transaction

Completion condition. Invoice PAID (or fully settled by adjustments outside V1).

Failure and exception scenarios.

  • Conversion is attempted twice → rejected by a one-to-one relation; there is no second order/invoice from the same source.
  • Quote expired before acceptance → EXPIRED; create a new quote.
  • Totals sent by the browser disagree with line items → ignored; the backend recomputes.
  • Payment exceeds outstanding → rejected.
  • Two payments recorded concurrently → the invoice row lock serialises them; one RECORDED payment per invoice is enforced.
  • Cancelling an order/invoice after issue → allowed only through its dedicated action, and recorded as a terminal state.

Automation. Quote expiry (expire_due_quotes), invoice overdue scan, and due-date reminders exist as scheduled/background tasks. Notifications and emails are queued after commit.


2. Buying from suppliers

Starting point. A need is identified by a department or a project.

Requisition → Approval → RFQ (invite suppliers) → Supplier quotes → Select quote
   → Purchase order → PO approval → Send to supplier
   → Goods receipt (full/partial/rejected) → Supplier bill
   → Three-way match (PO ↔ receipt ↔ bill) → Payment / Credit note / Refund
StepState changeNotes
RequisitionDRAFT → submitted → APPROVED / REJECTEDApproval policy decides who must approve (thresholds not documented — see DG-24).
RFQDRAFT → ISSUED → closed/cancelledInvitations tracked per supplier.
Supplier quotereceived → SELECTED / rejectedOne quote is selected per RFQ.
Purchase orderDRAFT → pending approval → APPROVED → sent → partially/fully received → CLOSED / CANCELLEDRevisions are recorded; re-approval supported.
Goods receiptpending → ACCEPTED / PARTIAL / REJECTED, reversibleReversal restores received quantities.
Supplier billDRAFT → ISSUED → paid/partly paid → CANCELLEDThree-way match exceptions must be resolved or accepted.
Supplier paymentRECORDED → REVERSED / CANCELLEDCannot exceed the bill's outstanding amount.
Credit noteissued and applied against billsRefunds/advances tracked separately.

Who. USER creates records; approval, receipt reversal, and payment actions need their own grants (OWNER/ADMIN, MANAGER for some).

Automation. Scheduled reminders for expiring contracts, stale approvals, overdue supplier bills, and past-due RFQs.

Failure scenarios. Receiving more than ordered → blocked. Receiving a cancelled PO → blocked. Paying before the bill is issued → blocked. Match exception left open → bill cannot proceed until handled.


3. Delivering a project

Starting point. A sold engagement. A project is created (optionally referencing the customer account), members are added, and milestones are dated.

StepState changeNotes
Create projectDRAFT/plannedDates define the valid range for milestones and tasks
ActivateACTIVEprojects.project.activate
Add tasksstatus open → in progress → doneBoard and list views
Log timetime entries with start/stop, optionally linked to a taskOne running timer per user
Manage budget and expensesbudget draft → approved; expenses submitted → approved/reversedfinancials.* grants
CompleteCOMPLETEDprojects.project.complete; archived projects cannot be completed
CancelCANCELLEDprojects.project.cancel

What is automatic. Overdue-task reminders, due-date notifications, project financial snapshots, profitability calculations.

Failure scenarios. Milestone or task dates outside the project range → rejected (SF-016). Completing an archived project → rejected. Expense above budget → flagged; approval policy decides the outcome (thresholds undocumented).


4. Running a marketing campaign (Reach)

Contacts (import/manual) → Consent + suppression check → Audience
   → Template → Campaign → Approval → Schedule → Send → Events/Analytics
StepWhoNotes
Import/build contactsUSER+Suppressed addresses are excluded
Build audienceUSER+Static membership
Create campaignUSER+Chooses audience, template, sender
ApproveOWNER/ADMIN (reach.campaign.approve)When approval is required is a product rule not yet documented (DG-25)
Schedule/sendOWNER/ADMIN or MANAGERPause and cancel supported
Review eventsUSER+Delivered, opened, clicked, bounced, complained

Failure scenarios. Unverified sender domain → sending is not allowed. Suppressed contact in audience → excluded. Provider outage → messages remain with a failure status and can be retried where supported.


5. Inviting a teammate

  1. OWNER/ADMIN opens Control → Users → Invite (or Invitations).
  2. Enters email and role. The backend creates a single-use token (stored hashed, default 7-day expiry) and supersedes any pending invitation for that email.
  3. Email is queued after the transaction commits.
  4. The invitee opens the link. If they have no account, one is created; the membership becomes ACTIVE in the same transaction. If they already have an account, the membership is added to it.
  5. Seat limits from the plan are enforced at acceptance.

Failure scenarios. Invitation expired, revoked, already used, or organization suspended → acceptance fails with a clear reason. Duplicate pending invitation → the newest wins. Seat limit reached → acceptance refused until a seat is freed.


6. Automating a follow-up

  1. OWNER/ADMIN creates a workflow: one trigger (record created/updated/deleted, status changed, assignment changed, or a schedule), conditions (AND/OR), ordered actions.
  2. Enable it. Only enabled workflows run.
  3. A business service fires the event inside its transaction; a PENDING execution row is written and the worker is dispatched after commit.
  4. The worker claims the execution, evaluates conditions, runs actions in order, writes an immutable step log, and marks SUCCEEDED / FAILED / SKIPPED.
  5. workflow_executed / workflow_failed activities are recorded.

Guarantees and limits. The business transaction never fails because automation failed. In-flight executions are deduplicated per (workflow, target), which also prevents recursion. A failed execution is retried by the worker and remains visible in execution history.

Failure scenarios. Conditions never match → execution SKIPPED. Action targets a record the workflow's own action changed → recursion is blocked by the dedupe constraint. Worker unavailable → executions wait in PENDING.


7. Becoming a customer of SahajFlow (tenant onboarding)

Sign up → verify email → sign in → choose/create workspace → land on dashboard
  • Signup creates a login only; it creates no organization.
  • Creating a workspace provisions, in one transaction: the organization, the OWNER membership, a subscription plan (Starter by default, or the chosen launch plan), a default CRM pipeline with standard stages, and the owner's employee profile.
  • Invited users skip workspace creation and land in the inviter's workspace.

Failure scenarios. Unverified email → sign-in blocked with EMAIL_NOT_VERIFIED. No membership → the app routes to workspace selection instead of a broken dashboard. Suspended tenant → every tenant endpoint fails with a suspension error until platform staff reactivate it.


8. What is not an implemented workflow

Documented elsewhere or assumed by users, but not built:

  • Lead → Contact → Opportunity with people records (no CRM Contact model).
  • Quote → Razorpay/UPI collection link (no payment gateway integration in Q2C).
  • Two-way Google Calendar sync (import only).
  • Tally or GST-return export (roadmap only).
  • Customer self-service portal.
  • Mobile app or offline mode.

On this page