Hello everyone!
Welcome back to the Kaizen series!
Discount approvals are a standard part of sales governance.
Most organizations need something like this:
Discount % | Required Action |
< 10% | Auto-approve |
10–19.99% | Sales Manager approval |
≥ 20% | VP Sales approval |
Zoho CRM already includes a powerful
Approval Process feature capable of routing records, locking them, notifying approvers, and maintaining audit history.
So the natural question is "Isn’t the native Approval Process enough?". Often, yes. But when the discount logic depends on accurate percentage calculation across line items and header adjustments, we need a small architectural enhancement.
This Kaizen combines Functions(for decisions), Workflow Rules(for triggers), Approval Process(for governance), and Reporting Hierarchy(for routing) into a clean, scalable solution.
Understanding the native Approval Process
Before adding anything custom, it’s important to recognize what the Approval Process already does extremely well.
- Evaluates criteria based on field values
- Automatically submits records
- Locks records during review
- Routes to users, roles, or hierarchy levels
- Maintains approval history
- Sends notifications
It is a powerful governance engine.
However, it evaluates existing values and does not calculate new ones. That distinction matters in discount scenarios.
The missing piece: Reliable discount percentage
In Quotes:
- Discounts may be applied at line-item level
- Discounts may be applied at header level
- Grand Total reflects cumulative adjustments
There is no guaranteed native field that consistently represents
True Discount % = (Sub_Total - Grand_Total) / Sub_Total * 100
If approval rules rely directly on partial fields(like “Discount”), they may misrepresent the effective discount.
To ensure accuracy, we introduce a Function to calculate and store a reliable Discount Percentage.
We are not replacing the Approval Process, but preparing accurate data for it.
Here is the architectural flow with each component having a distinct responsibility. This makes the system sustainable.
Quote Saved --> Workflow triggers Function --> Function calculates Discount % --> Function sets Approval_Status --> Approval Process evaluates status --> Record submitted and locked |
Let's go over this one step at a time.
Step 1: Create Custom Fields(Quotes Module)
Field | Type | Purpose |
Discount_Percentage | Percent | Stores calculated discount |
Approval_Status | Picklist | Controls approval trigger. Values:
- Auto Approved
- Pending Manager Approval
- Pending VP Approval
- Approved
- Rejected
|
| Approval_Level | Single Line | Displays routing level |
Step 2: Write the CRM Function(Decision Layer)
This function calculates the effective discount and determines the approval level. This function becomes the decision engine.
void automation.Set_Quote_Approval_Level(String id) { quoteId = id.toLong(); quoteDetails = zoho.crm.getRecordById("Quotes",quoteId); if(quoteDetails != null) { subTotal = ifnull(quoteDetails.get("Sub_Total"),0).toDecimal(); grandTotal = ifnull(quoteDetails.get("Grand_Total"),0).toDecimal(); discount = subTotal - grandTotal; discountPercentage = 0.0; if(subTotal > 0) { discountPercentage = discount / subTotal * 100; } approvalStatus = ""; approvalLevel = ""; if(discountPercentage < 10) { approvalStatus = "Auto Approved"; approvalLevel = "None - Auto Approved"; } else if(discountPercentage < 20) { approvalStatus = "Pending Manager Approval"; approvalLevel = "Sales Manager"; } else { approvalStatus = "Pending VP Approval"; approvalLevel = "VP Sales"; } updateMap = Map(); updateMap.put("Discount_Percentage",discountPercentage.round(2)); updateMap.put("Approval_Status",approvalStatus); updateMap.put("Approval_Level",approvalLevel); updateResponse = zoho.crm.updateRecord("Quotes",quoteId,updateMap); } } |
Step 3: Workflow(Trigger Layer)
Every time a quote is saved, we want the discount to be evaluated automatically.
Create the following Workflow Rule:
Module: Quotes
Trigger: On Create or Edit
Action: Execute Function
Map the Quote ID with the "id" argument in the function.
Step 4: Approval Process(Governance Layer)
Rule 1 - Manager Approval when Discount% is 10 to 19.99
Approval_Status = "Pending Manager Approval" --> Route to Sales Manager(via hierarchy)
Rule 2 - VP Sales Approval when Discount% >= 20
Approval_Status = "Pending VP Approval" --> Route to VP Sales(via hierarchy)
When this process is triggered, CRM:
- Submits the record for approval
- Locks it
- Sends notification
- Tracks approval history
The outcome
Why is this layered approach strong?
This design works well because each component in the system has a clearly defined responsibility. The CRM Function acts as the decision layer. It performs the discount calculation, determines the appropriate approval level, and updates the control fields. This ensures that the logic behind the approval requirement is accurate and intentional.
The workflow serves as the trigger layer. Its only job is to execute the function whenever a quote is created or edited. It does not contain business logic; it simply initiates the evaluation process at the right time.
The approval process becomes the governance layer. Once the function sets the appropriate status, the approval engine evaluates the criteria, submits the record, locks it, routes it to the correct approver, and maintains the approval history. This is where enforcement happens.
Finally, the reporting hierarchy determines who the approver is. Instead of hard-coding specific users, the system dynamically identifies the appropriate manager or second-level supervisor based on the role structure. This keeps the design scalable and adaptable to organizational changes.
By separating calculation, triggering, enforcement, and routing into distinct layers, the solution remains clean, maintainable, and easy to extend. The Approval Process continues to do what it does best—govern and enforce—while the Function ensures that the decision it evaluates is accurate and business-driven.
Summary
Zoho CRM’s native Approval Process is powerful and reliable.
When business logic depends on calculated values, like true discount percentage, introducing a function strengthens the design by ensuring accurate, consistent decision-making.
Used together, Functions and Approval Process create:
- Intelligent routing
- Accurate governance
- Clean audit trails
- Scalable architecture
That combination is what makes this solution robust.
We hope you liked this post. We'll see you next week with another interesting one!
Write to us at
support@zohocrm.com or let us know your feedback in the comments section of this post.
Cheers!
==========================================================================