Kaizen 241 - Automating Deal Risk Escalation Using Workflow APIs, Connected Workflows, and Functions

Kaizen 241 - Automating Deal Risk Escalation Using Workflow APIs, Connected Workflows, and Functions


Hello everyone!

Welcome to another Kaizen week.

In many organizations, sales teams work in Zoho CRM, finance teams manage invoices in Zoho Books, and support teams handle customer issues in Zoho Desk. Now consider this scenario:

A sales representative is working on a high-value upsell opportunity for an existing customer. The deal has reached the final negotiation stage and is ready to move forward. From the sales team’s perspective, everything looks fine. However, the finance team may know that the customer has unpaid invoices, while the support team may already be handling unresolved tickets for the same customer.

Sales teams typically do not verify these details manually every time a deal progresses, which can lead to risky business decisions.

In this post, we will build a cross-app risk validation flow for high-value deals in Zoho CRM. When a deal enters the Negotiation/Review stage, the automation checks for unpaid invoices in Zoho Books and open support tickets in Zoho Desk, updates risk fields in CRM, escalates risky deals into a connected review process, and resumes deal progression only after approval.

To implement this, we will use a combination of:

 Prerequisites 

Before implementing this flow, make sure the following are already available:

  • Zoho CRM with access to Workflows, Custom Functions, and Connected Workflows.

  • Zoho Books and Zoho Desk configured for the same business context, and integrated with Zoho CRM. Check these links for more details : CRM - Books integration help, CRM - Desk integration help.

  • Active connections from Zoho CRM to Zoho Books and Zoho Desk.

  • The Deals module in CRM.

  • A custom module called Risk Reviews.

 

NOTE: This implementation assumes that the Zoho Books and Zoho Desk integrations are already configured and CRM connections are available for use inside Deluge invokeurl calls. In the sample function, these are referenced as books_connection and desk_connection.

The connections must include the scopes required by the APIs used in the custom function:

  • the Zoho Books connection should include scope(s) to read invoices

  • the Zoho Desk connection should include scope(s) to read contacts and tickets

If these scopes are missing, the invokeurl calls in the custom function will fail even if the workflow and Deluge logic are configured correctly.

 CRM Setup   

 Fields to Add 

Add three fields to the Deals module:

  • Approval_Status : Tracks the validation/approval state (Picklist field : Pending Validation, Approved, Escalation Required)

  • Invoice_Risk_Count : Number of problematic invoices found (Number field)

  • Open_Ticket_Count : Number of open support tickets found (Number field)

 Risk Reviews Module 

Create a custom module called Risk Reviews to store escalation records for Deals. Each Risk Review record remains connected to the originating Deal so that the review process is traceable and the original Deal can be updated automatically after approval.

Include the following fields in the Risk Reviews module:

  • Review_Status (Picklist: Pending, Approved, Rejected, Needs Clarification)

  • Risk_Type (Multiselect Picklist: Invoice Risk, Support Risk, Both)

  • Deal (Lookup to Deals module)

  • Account (Lookup to Accounts module)

  • Deal_Amount (Currency)

  • Reviewer (User field)

  • Comments (Long Text)

  • Escalated_On (DateTime - auto-populated when created)

  • Reviewed_On (DateTime - populated when review is completed)

 Step 1: Create the workflow rule   

Whenever a deal enters the final negotiation stage, we want the system to validate whether the customer has any financial or support-related risks before allowing the deal to move forward.

Workflow Trigger Conditions:

  • Stage = Negotiation/Review

  • Deal Amount > threshold value. In this example, we use ₹250000 as the high-value threshold.

This ensures that only high-value deals go through this validation process.Create this using the Create Workflow Rule API. The workflow contains a single instant action: execute a custom function.

Find the Workflow Rule API input JSON here.


 Solution flow


Custom Function 

Once triggered, the workflow executes a custom function.  The function accepts a single input parameter, dealId, from the workflow context and performs the validation logic in five steps.

 1. Fetch deal details from Zoho CRM   

It first fetches the deal record and extracts:

  • Deal stage

  • Deal amount

  • Current approval status

  • Account details

  • Contact details

These values are used both for qualification checks and for matching records across Zoho CRM, Zoho Books, and Zoho Desk.

 2. Check whether the deal qualifies for validation   

We do not want every deal to go through this process. The function exits if:

  • the deal is not in the Negotiation/Review stage

  • the deal amount is below ₹250000

This avoids unnecessary API calls and keeps the validation logic focused only on high-value deals. In a production implementation, this threshold can be moved into a configurable setting instead of being hard-coded in the function.

 3. Check invoice risk in Zoho Books   

The function fetches invoices using the configured Books connector and Zoho Books APIs. It then loops through the returned invoices and counts records where:

  • customer_name matches the CRM Account name

  • status is one of:

    • unpaid

    • overdue

    • draft

The count is stored in Invoice_Risk_Count.

In the current implementation, the CRM Account is matched to Zoho Books using the account display name. This works for simple cases, but according to your implementation,  it is better to match using a stable customer identifier instead of relying only on account names.

 

 4. Check support risk in Zoho Desk   

The function validates support risk in two stages.

First, it fetches Desk contacts using the configured desk_connection and identifies the matching contact by comparing the Desk contact email with the CRM Contact email.

Once a match is found, the function fetches Desk tickets and counts records where:

  • contactId matches the identified Desk contact

  • status = Open

The final count is stored in Open_Ticket_Count.

 5. Determine approval status   

Once both validations are complete, the function determines the new approval state:

  • if Invoice_Risk_Count > 0 or Open_Ticket_Count > 0, set Approval_Status to Escalation Required

  • otherwise, set Approval_Status to Approved

The function always refreshes:

  • Invoice_Risk_Count

  • Open_Ticket_Count

It updates Approval_Status only if the new value is different from the current one. This avoids unnecessary status updates while still keeping the numeric risk fields current.

Find the full Deluge function code here.

To make this automation safer in implementations, it is also a good idea to prevent duplicate escalations. For example, before creating or triggering a new review cycle, you can check whether an open Risk Review record already exists for the same Deal.  

Note: If you have high invoice volumes or large contact bases, extend this implementation with pagination, server-side filtering, and error handling.

Step 2: Create the Connected Workflow  

At this stage, the function has already identified whether the deal is risky.

If no risks are found, the Deal is approved and moves forward.

If risks are found, the process needs to do more: create a review record, notify stakeholders, wait for a human decision, and then update the original Deal once that decision is made. This kind of multi-record, multi-stage flow can technically be assembled using a combination of separate workflow rules and custom functions, each reacting to field changes across modules. But that means you are manually maintaining the relationships between those rules, keeping track of which record triggered what, and ensuring updates flow back correctly to the originating Deal.

Connected Workflows are built specifically for this pattern. They let you define the entire cross-record process in one place, where each stage is explicitly linked to the record that triggered it. The Risk Review stays connected to the Deal it came from, so when a reviewer approves it, the platform knows exactly which Deal to update, without you wiring that logic together separately.

This keeps the process traceable, reduces the number of moving parts you need to maintain, and makes the flow easier to extend later if you add outcomes like Rejected or Needs Clarification.

The first step is to create a Connected Workflow using the Create a Connected Workflow API, where you define the root node, name and description. After that, you can add rules using the Add a Rule to a Connected Workflow API.

Download the input JSON to create a Connected Workflow for Deals module here.

 First Connected Workflow Rule: Deal > Risk Review   

The first connected workflow rule runs when the Deal record gets updated by the function.

Trigger: Approval_Status = Escalation Required

When this happens, the rule performs two actions.

 Action 1: Create a connected record  

A connected Risk Review record gets created automatically.

Fields such as Deal name, Account, Deal amount, and risk-related details are mapped from the Deal. Additional fields such as Review_Status and Risk_Type are also populated so that reviewers can immediately understand why the Deal was escalated.

Action 2: Send escalation email  

Once the review record is created, an email notification is sent to the relevant stakeholders to inform them that the deal requires review before progressing further. This action is created using the Email Notifications API. Click here for the input JSON to create Email Notification Action request.


To download the input JSON for adding this rule to the Connected Workflow, click here.

 Second Connected Workflow Rule: Risk Review > Deal   

Once reviewers complete their review, the process should move back to the original Deal. This is handled by the second connected workflow rule.

Trigger: Review_Status = Approved

When the Risk Review record is updated to Approved, the rule performs two actions.

 Action 1: Update the Deal record   

The related Deal record gets automatically updated using a field update action. The Approval_Status will be updated to Approved, allowing the sales team to continue progressing the Deal. 

This action is created using the Create Field Update Action API. Click here to download the input JSON for this request.

 Action 2: Send approval email   

Once the Deal is approved, another email notification is sent.

This informs stakeholders that the review is complete, risks were addressed and the deal can now move forward. This action is created using the Create Email Notification API.

You can also extend this flow by defining additional outcomes such as Rejected or Needs Clarification, depending on your review process.

Attached files:

 

By combining Zoho CRM workflows, custom functions, Connected Workflows, and action APIs, we can turn a manual risk checkpoint into a structured and traceable approval process.

This pattern is useful whenever CRM decisions depend on data spread across multiple Zoho applications. By combining workflows, custom functions, and Connected Workflows, businesses can enforce validations, reduce manual checks, and create more reliable approval processes.

For production use, you can extend this implementation further by:

  • making the threshold configurable

  • storing stable cross-app identifiers for more reliable matching

  • preventing duplicate review creation

  • adding rejection or revalidation paths

  • logging integration failures for easier troubleshooting.

If your business process depends on data spread across multiple Zoho applications, this is a practical way to orchestrate that logic inside CRM.

You can find all the sample files used in this implementation, including the workflow JSONs, Connected Workflow configurations, email actions, field update actions, and Deluge function code here: Project files

We hope you found this useful. If you have any questions, feel free to leave a comment below or reach out to us at support@zohocrm.com



    • Sticky Posts

    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Kaizen #226: Using ZRC in Client Script

      Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
    • Kaizen #222 - Client Script Support for Notes Related List

      Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
    • Kaizen #217 - Actions APIs : Tasks

      Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
    • Kaizen #216 - Actions APIs : Email Notifications

      Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
      • Recent Topics

      • Partner with HDFC And Sbi Bank.

        Hdfc and sbi both are very popular bank if zoho books become partner with this banks then many of the zoho books users will benefit premium features of partnered banks.
      • #12 Never Leave a Billable Hour Behind

        A client approves a website redesign project. The estimated effort? 40 hours. The project is going well. A few additional review meetings are scheduled. Several rounds of content changes are requested. A few "quick fixes" get added along the way. The
      • Close task on Completion Date entry

        This discussion is similar to my issue: "backdated-task-completion-date" discussion Scenario: A bunch of tasks have been completed. But, they have not been closed. Time goes by You finally get around to closing those tasks Projects assigns the date the
      • Can I add Conditional merge tags on my Templates?

        Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
      • Records from ATE 29: Knowledge Base, Community, and AI for smarter User Education

        Hi Everyone, "Ask the Experts 29" was an engaging session, where we explored how to utilize the Knowledge Base for customers and internal teams, as well as emphasizing the importance of our Community. This post highlights the questions and use cases discussed,
      • Deleted User Emails

        I need to delete a user as I need to re-use their license, but I'd like to keep all their emails that are attached to various contacts in the CRM. Their emails are hosted externally on an M365 license. Anyone any idea how best to engineer this? TIA
      • Its 2022, can our customers log into CRM on their mobiles? Zoho Response: Maybe Later

        I am a long time Zoho CRM user. I have just started using the client portal feature. On the plus side I have found it very fast and very easy (for someone used to the CRM config) to set up a subset of module views that make a potentially extremely useful
      • Zoho CRM upload files error

        Since today, we have been experiencing issues with uploading photos to opportunities. The message indicates that the storage is full, but as far as I can see, there is still plenty of space available. Could there be an issue or a bug?
      • Kaizen #246 - Incoming Lead Email Intent Detection using Zia Assistant API in Zoho CRM

        Hello all! Welcome back to a fresh Kaizen week. In this post, we will explore how Zia detects positive intent from incoming emails in the Leads module using the Zia Assistant API along with Workflow Rules and Custom Functions in Zoho CRM. Use Case Problem
      • Smart URL Determination

        I would like to see Vault implement some sort of "smart" URL determination. When one starts to add a new username-password combination from a new site, Vault brings in the exact URL of the page from which this is happening. All too often, it looks something
      • Removing To or CC Addresses from Desk Ticket

        I was hoping i could find a way to remove unnecessary email addresses from tickets submitted via email. For example, a customer may email the support address AND others who are in the helpdesk notification group, in either the TO or CC address. This results
      • Tip #76- Exploring Technician Console: Quick Launch- 'Insider Insights'

        Hello Zoho Assist Community! Welcome back to our Technician Console series. Last time we explored Power Options, and this time we are turning the spotlight on a feature that quietly saves you dozens of clicks in every session by getting you exactly where
      • Multi-Book Accounting Support in Zoho Books

        Currently, businesses that operate multiple entities, regions, or divisions need to maintain separate Zoho Books instances or resort to manual consolidation processes. This creates significant operational friction and increases the risk of errors. PROBLEM:
      • Automated Multi-Subsidiary Consolidation Engine in Zoho Books

        For organizations managing multiple subsidiaries across different geographies or business units, consolidation is a quarterly/annual nightmare. Zoho Books lacks native consolidation tools, forcing companies to export data, manipulate it in Excel, and
      • Zoho Books | Product updates | April 2026

        Hello users, Welcome to our April 2026 product updates roundup! Highlights include profit margin for sales transactions, insights in reports, recording deposits from undeposited funds in banking, and faster production workflows with improved assembly
      • Unable to charge GST on shipping/packing & Forwarding charges in INDIA

        Currently, tax rates only apply to items. It does not apply tax to any shipping or packing & forwarding charges that may be on the order as well. However, these charges are taxable under GST in India. Please add the ability to apply tax to these charges.
      • How to add packing & forwarding charge in purchase order & quotation???

        Hello Zoho Team I have just started using Zoho for my company and I wanted to make purchase order. My supplier charges fix 2% as packing & forwarding on Total amount of material and then they charge me tax. For example, Material 1 = 100 Rs Material 2
      • How to book GST paid in zoho books

        hi, i am a new user to Zoho books and not able to book GST paid in books, kindly suggest how i can book it in books. thanks, siddharth
      • [Bug] WebAuthn passkey registration blocked on rpIds with TLDs longer than 6 characters (.accountant, .technology, etc.) — isValidDomain regex too strict

        Hi, Filing on behalf of an enterprise customer where Zoho Vault is deployed across the company. The Chrome extension blocks WebAuthn passkey registration on legitimate sites whose Relying Party ID (rpId) has a TLD longer than 6 letters. This affects every
      • Zoho Payroll: Product Updates - H1, 2026

        Over the last few months, Zoho Payroll has added updates that make payroll easier to process, review, explain, and manage for businesses. The most important improvements focus on payroll flexibility, gratuity tracking, employee self-service, reporting,
      • Pushover Notification Module

        Hello, it would be good if there would be a "Pushover" (https://pushover.net/) module besides the standard SMS module. Pushover is now very well known, especially in IT, and is becoming more and more popular. The biggest advantage are the customizable
      • E-Mail Blacklist via GUI

        Hello, It would be helpful if the GUI included an option to block specific email addresses (both incoming and outgoing). I want a setting where I can completely block certain email addresses. This means that no tickets can be opened from those addresses,
      • How to migrate cpanel mail to new zoho mail?

        Hi, I have a client whose email (for his website domain) is currently on "cpanel mail". Now client wants to move to Zoho Mail. I checked migration docs and its mentioned that I can migrate using IMAP or POP but I am not getting exactly what steps should I follow in order to achieve this. As soon I will add clients domain and setup MX Records and SPF for that, I will lose access to currently setup email (cpanel mail) and without adding domain in zoho mail, I can't setup email for that. Sorry if I
      • SalesIQ Integration with LINE: API Rate Limit Issue and Pre-Chat Flow Concerns

        Hello SalesIQ Developer Team. I have investigated the issue and found that the LINE Rate Limit is being consumed unusually quickly. LINE API free usage limit: 300 messages per month per brand. This limit will be reached within the first few days. 1. LINE
      • What's New in Zoho Inventory | April & May 2026

        Hello users, We're excited to roll out the latest Zoho Inventory updates for April and May 2026. These enhancements are designed to make your daily operations smoother and more efficient, from advanced inventory management and flexible pricing to automated
      • How to Backup Zoho to PST?

        I'm looking for a simple way to backup Zoho Mail emails to PST format. I tried the IMAP method with Outlook, but it seems slow and complicated for large mailboxes. I need a solution that can: Export Zoho emails to PST Preserve attachments and folder hierarchy
      • Warehouse -> Locations Transition Causing Errors

        After saying "okay" to the transition from 'warehouses' to 'locations', I've now got shipped Sales Orders that I cannot invoice. How does one proceed?
      • Zoho CRM Community Digest - May 2026 | Part 1

        Hello Everyone! This edition introduces the new centralized Zoho Announcements Hub, a single dashboard designed to let you track and filter live product roll-outs from across the Zoho ecosystem. Alongside the Announcements Hub, this month also features
      • SalesIQ : How to disable markdown autoformatting?

        Hello Is there setting to disable "Markdown Text" this feature and enter raw markdown in plain text only format it after you send the message? Thanks
      • Converting XML to JSON

        Hi! I need to convert a variable in XML to JSON. Can i do it without using an API on deluge? I looked into the documentation but couldn't get any answers to this. Thank you in advance!
      • 元問い合わせメールに返信したときの統合処理

        ワークフロー作成したので備忘録です。 Zoho Desk で作成したメールアドレス宛てに既存のメールアドレスにきた問合せ先メールを転送してチケット作成を行っています。 元の問い合わせメールに返信、転送した際にRe,RE,re,Fw,FW,fwが件名の頭に付くため、その度に新規起票が乱立します。 メールの頭にRe,RE,re,Fw,FW,fwがある時それを除いた件名と同じ件名が既にチケット作成されていれば統合するワークフローを作成しました。 条件が緩いので既存チケットの検索で完了済みや5日以上前に作成したものは除いてもいいとは思います。
      • Marketing Automation Demo Video

        I would like to see a video demo for Marketing Automation.  Do you have one statashed away somewhere?
      • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

        so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
      • Supervisor Rules --> Custom Function

        Hello, currently I can't add a custom function to a supervise rule. Is there a reason for this? Background: We have BluePrint managed tickets and actually we have a Supervise rule which should set the ticket to "closed" after 168 hours since the last
      • Automate Backups

        This is a feature request. Consider adding an auto backup feature. Where when you turn it on, it will auto backup on the 15-day schedule. For additional consideration, allow for the export of module data via API calls. Thank you for your consideration.
      • How to record GST amount for Value of Service on Inward remittance charged by bank

        Hi please advice I have a situation.    1. I have HDFC bank account 2. I have a customer who has done inward remittance for purcahses from overseas. 3. HDFC is showing Value of Service say $100 and GST @ 18%. 4. Value of Service is not charged. But  CGST
      • Sort by Project Name?

        How the heck do you sort by project name in the task list views??? Seems like this should be a no-brainer?
      • Project Statuses

        Hi All, We have projects that sometimes may not make it through to completion. As such, they were being marked as "Cancelled". I noticed that these projects still show as "Active" though which seems counter intuitive. In fact, the only way I can get them
      • I have a requirement to integrate Zoho Books with Zoho Projects at both project and task levels.

        Currently, when i create transactions in Zoho Books (Expenses, Invoices, Bills), we can only map them at the project level. However, our requirement is to: Map records at both project and task levels Sync these transactions back to Zoho Projects under
      • What’s New in Zoho Inventory — Latest Features, Integrations & Updates | December 2025

        Zoho Inventory has evolved significantly over the past months, bringing you smarter, faster, and more connected tools to streamline your operations. Whether you’re managing multichannel sales, complex fulfillment workflows, or fast-moving stock, our newest
      • Next Page