> **Source:** https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/rule-categories > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # Rule categories Every rule changes exactly **one of three field properties**. That gives you three rule categories — and for any requirement, your first question is: *which property does this change?* Answering that tells you which category you're building, which examples to copy from, and how to fill in the [rule spec](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/turn-a-requirement-into-a-rule). > **Note — Category shorthand** > > You'll sometimes see these referred to by letter — **A** Mandatory, **B** Editable, **C** Value. The letters and the property names mean the same thing. ## A · Mandatory rules Turn a field's **required flag** on or off based on another field's value. The workflow won't let the stage complete until a mandatory field is filled. *Example:* Say the requirement is **"Make Reviewer mandatory IF Loan Amount > ₹10,00,000."** Big-ticket loans need a human check before they go out, while smaller ones don't need to wait on one — so instead of always requiring a Reviewer, the rule watches the Loan Amount and switches the Reviewer field's mandatory flag on only once it crosses the threshold. Below ₹10,00,000, the stage completes without one. Mandatory rules aren't limited to switching a requirement on, either — they can relax one too: - **Make FATCA Declaration mandatory IF Customer Type = NRI** — a regulatory field that only applies to one customer segment. - **Make Insurance Consent *non*-mandatory IF Insurance = No** — the same mechanism, run in reverse. → How-to: [Make a field mandatory with a rule](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/how-to/make-a-field-mandatory) ## B · Editable rules **Lock or unlock** a field. The field stays visible — the reader can see the value — but whether it can be changed depends on your condition. *Example:* Take **"Lock Branch Code IF Source = LOS API."** When a branch code arrives pre-filled from the LOS API, it's a system-supplied value — there's no reason a runner or invitee should be able to hand-edit it, and every reason they shouldn't. The rule watches the Source field, and the moment it reads "LOS API," Branch Code switches to non-editable. It's still visible so everyone can see what value is being used; it just can't be changed. The same pattern applies wherever a value needs to be frozen once it's trustworthy: - **Lock Customer Name IF KYC Verified = true** — once identity is verified, the name shouldn't move. ## C · Value rules **Compute or assign a value.** This is the most powerful category, because the right-hand side of the rule isn't limited to a constant — it can be: - **A constant** — eSign Type = Aadhaar - **Arithmetic across fields** — Stamp Group Amount = Loan Amount × Stamp Duty % - **A lookup** — Stamp Duty = lookup(State, Loan Amount) - **A value from another part of the workflow** — Payment Collect Amount of Invitee 1 = Stamp Group Amount of Document 1 *Example:* The classic case is **"Stamp Group Amount = Loan Amount × Stamp Duty %."** Nobody should have to do that arithmetic by hand, and nobody should have to remember to redo it if either input changes — so the rule fires the moment both Loan Amount and Stamp Duty % are filled, computes Stamp Group Amount itself, and recomputes it automatically if either input is edited afterward. The right-hand side isn't limited to arithmetic, though — the same category covers lookups, conditional constants, and values copied from elsewhere in the workflow: - **Stamp Duty = lookup(State, Loan Amount)** — duty tables differ by state, so the rule resolves the right rate. - **eSign Type = Aadhaar IF Loan > ₹1,00,000, else Virtual Sign** — a value rule can route the signing experience by tier. → How-to: [Calculate a field's value with a rule](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/how-to/calculate-a-field-value) ## Beyond the three: two special kinds Two kinds of rules dominate real deployments and sit slightly outside the A–C property model. They're still rules — but they're worth recognising as their own shapes. ### Validation rules A validation rule checks a condition when the user clicks **Proceed** and, if the check fails, **blocks the stage with an error message**. This is how "make X mandatory" requirements often ship in practice: rather than flipping the mandatory flag, the rule verifies the field at Proceed time and explains exactly what's missing. > *Example:* IRN must follow the format `123-456789_ABC` with a valid sequence code. If any document's IRN is missing or malformed, Proceed is blocked and the error names the offending document. → How-to: [Validate fields before Proceed](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/how-to/validate-before-proceed) ### Assignment rules An assignment rule applies **structural defaults** when something is added to the workflow — most commonly, auto-assigning documents to invitees, or applying a standard settings bundle to every newly added invitee. > *Example:* every newly added document is automatically assigned to all invitees, so the sender never has to wire assignments by hand. → How-to: [Auto-assign documents with a rule](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/how-to/auto-assign-documents) ## Choosing the category: a 10-second habit When a requirement lands, ask in order: 1. Is the ask about a field being **required**? → Mandatory (A) 2. About a field being **changeable or frozen**? → Editable (B) 3. About a field **getting a value** — computed, looked up, or copied? → Value (C) 4. About **stopping Proceed** with a message? → Validation 5. About **defaults applied when things are added**? → Assignment Then write it down — [Turn a requirement into a rule](https://knowledge.leegality.com/document-execution/workflows/v4/rule-engine/turn-a-requirement-into-a-rule) gives you the six-line format.