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

        • Text/SMS With Zoho Desk

          Hi Guys- Considering using SMS to get faster responses from customers that we are helping.  Have a bunch of questions; 1) Which provider is better ClickaTell or Screen Magic.  Screen Magic seems easier to setup, but appears to be 2x as expensive for United States.  I cannot find the sender id for Clickatell to even complete the configuration. 2) Can customer's reply to text messages?  If so are responses linked back to the zoho ticket?  If not, how are you handling this, a simple "DO NOT REPLY" as
        • Need complete Zoho Commerce theme ZIP example and safe staging workflow

          I want to build a complete custom Zoho Commerce storefront through Edit Code, including: • Global header and footer • Responsive homepage • Category, search and filter pages • Product cards and product-detail pages • Cart and checkout wrapper • Mobile
        • Add Support to Upload Inventory Items with Categories or Enable Separate Upload for Inventory Categories

          Currently, Zoho Inventory does not support uploading new items along with their parent and sub inventory categories using the item import feature. This creates challenges for businesses with structured inventory hierarchies when trying to upload items
        • i need active of my whatsapp business number in zoho

          i am waiting from 3 days for active of my whatsapp business account in crm ,its too late to configure.its just showing account details i can't able to know its connected or not anything else
        • Sub-Form Padding in CSV Export

          Hi, When you use the Sub-Form, and for example you have a Date Field on the Main Page, then Option 1 and Option 2 fields on the Subform, when you export this to CSV the Date column will only have the Date in 1 row, the first row, it would be nice to pad
        • Integrate your Outlook/ Office 365 inbox with Zoho CRM via Graph API

          Hello folks, In addition to the existing IMAP and POP options, you can now integrate your Outlook/Office 365 inbox with Zoho CRM via Graph API. Why did we add this option? Microsoft Graph API offers a single endpoint to access data from across Microsoft’s
        • Analytics Dashboard User Filters Default Value

          User Filters on Dashboard do not allow Unknown to be set as a default filter value. I have to include NULL values in my dashboard among other values but I can't include NULL/Unknown by default in Dashboard User Filters.
        • Microsoft is retiring Exchange Web Services (EWS): Here's what it means for Zoho Mail users

          Microsoft has officially announced the retirement of Exchange Web Services (EWS) for Exchange Online. If your organization is planning to migrate from Microsoft 365 to Zoho Mail, you may be wondering what this change means for you. The good news is that
        • Zoho Writer page break in a merge repeating region always adds an unwanted blank page

          Hi I'm merging a Zoho CRM record to a Zoho Writer document with a repeating region to display subform records on their own page within the document. When I try to insert a page break in a repeating region, the resulting merge always adds an unwanted blank
        • ZeptoMail account pending review, SMTP blocked with relaying-issues

          Hi ZeptoMail team/community, Our ZeptoMail account has been pending review for more than 3 business days and still shows: “Your account is yet to be reviewed.” I already created a support ticket, but have not received an update yet. Ticket details: Request
        • Zoho ERP | Product updates | June 2026

          Hello users, We launched Zoho ERP on January 23, and since then, our goal has been to help businesses streamline and manage their operations with greater efficiency, flexibility, and control. Since the launch, we've continued to enhance the platform every
        • Tip #83- Give Customers a Faster Way to Reach You with the Quick Support Plugin – 'Insider Insights'

          Hello Zoho Assist Community! Think about the last time a customer needed urgent support. They emailed in, waited for a response, got a session link, couldn't find it in their inbox, called back, and by the time the session actually started, a good chunk
        • How to Open .mbox file in Gmail with Attachments?

          Gmail offer users to backup INBOX folder in .mbox file format via Google Takeout Feature. Howver there is no such option to Restore Gmail MBOX. Thus I would like to suggest you to choose an alternate approach i.e. MBOX to Gmail Wizard. This utility will open .mbox file in Gmail with attachments.  Steps to open MBOX file in Gmail are; Run MBOX to Gmail Wizard Click Add File and add .mbox file. Enter your Gmail login credentials. Click Convert button. Finished! This is how you can open MBOX file in
        • Seperate rating scales for KRA's and Competencies in appraisals

          Is there a way to set-up different rating scales for KRA's and Competencies?? I would like to have; Met/Not met for KRA's and a 1-5 scale for the competencies I know how to set up custom ratings but it spans across both sections and I need them to be
        • Is there a CRM Deluge function available to convert an RTF (rich text field) to plain text (with no formatting tags)?

          I know that we can run reports so that RTF fields can either show as plain text or the text or the text with the formatting fields included (which is wonderful, btw, as it helps me adjust tags when I need to troubleshoot and just see what I need to see
        • How do I set the value of a Lookup field in SlyteUI?

          I am using the "crm-field" component in a SlyteUI project (code attached) https://www.zohocrm.dev/explore/slyteui/ui-components/crm-field/api#Properties The client would like to have this field pre-populated with a value. When I try to input the record
        • Mise à jour de Zoho Books – France

          Chers clients, Merci pour votre patience et votre soutien continu. Avec les évolutions réglementaires à venir en France nous introduisons de nouvelles fonctionnalités dans Zoho Books pour les clients français. Ces mises à jour ont été conçues pour répondre
        • CRM Developer Update: Mandatory field behavior changes in Zoho CRM APIs

          We are planning a few updates to Zoho CRM APIs that are expected to be rolled out by the end of October 2026. These changes are not live yet. We are sharing this early so developers and partners can review the impact and prepare in advance. What is changing?
        • Show Available Stock as a Column in Item Views (Including by Warehouse)

          It would be very useful to have Available Stock as a standard column in the Items list view. Currently Stock On Hand does not show the real picture for businesses managing orders and inventory. Example: Stock on Hand: 100 Committed to Sales Orders: 80
        • What's New in Zoho POS - July 2026

          Hello everyone, Welcome to Zoho POS’s monthly update, where we share our latest feature updates, enhancements, events, and more. Let’s take a look at how July went. Support for Saudi's ZATCA Phase 2 e-invoicing We have added support for ZATCA (Zakat,
        • How to make Contact a Help Center User

          I see a "IsPortalUser" checkbox on each of the Customer account, but I am unable to check the checkbox. How is this configured?
        • Introducing the new Fields API

          Hello everyone, Greetings from Zoho Desk's API corner! With the rising need for integrations to connect multiple tools in businesses, APIs need to be adaptive, reliable, consistent, and ready for dynamic operations. To support better performance, efficiency,
        • Service locations are tied to contacts?

          Trying the system out. And what I discovered is that it seems that the whole logic of the app is, I'd say, backwards. There is a Customer - a company. The company has contact persons and service locations can be associated with different contact persons.
        • Zoho ResearchStudio Shutdown Notice

          Hi ResearchStudio fam, We are writing to inform you that Zoho ResearchStudio will be discontinued from Oct 5, 2026. Thank you for being a part of our journey and for trusting us with your qualitative research work. What this means for your data: Your
        • SlideShare Downloader PDF not syncing in Zoho WorkDrive

          Hi everyone, I use SlideShare Downloader for save study PPT and PDF files. After download I upload files in Zoho WorkDrive, but sometimes PDF preview not showing or sync take very long time. Small files work okay but some bigger presentation files have
        • メモの保存場所、見直しませんか?― Zoho Notebookで始める情報管理

          ユーザーの皆様、こんにちは。ゾーホージャパンの朝香です。 AIを利用した業務が広がる中、AIによる情報漏洩対策を進めている組織も多いのではないでしょうか。 一方で、日常的に使っているメモの管理については、対策できていますか? 業務中のメモには、重要な情報が含まれていることがあります。 そのため、AIへの入力だけでなく、メモの保存先についても是非確認をおすすめしたいと思います。 そこで今回は、使いやすさだけでなく、セキュリティにも配慮して設計されたZohoのノートアプリ「Zoho Notebook」をご紹介します!
        • Zoho Sheet offline is now live on iPhone

          Hello everyone, We've just rolled out offline support for Zoho Sheet on iOS—you can now create, edit, and analyze spreadsheets on your iPhone without an internet connection. Offline support has been a sustained priority for us. We're on the verge of bringing
        • You can now sync records from Custom Modules in Zoho CRM

          p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0.0cm; font-size: 12.0pt; font-family: Cambria; } p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph { margin-top: 0.0cm; margin-right: 0.0cm; margin-bottom: 0.0cm; margin-left: 36.0pt; font-size: 12.0pt; font-family: Cambria; } p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst { margin-top: 0.0cm; margin-right: 0.0cm; margin-bottom: 0.0cm; margin-left: 36.0pt; font-size: 12.0pt; font-family: Cambria;
        • Zoho ERP | Product updates | July 2026

          Hello users, We're back with another round of updates to help you streamline your operations. This month's release brings new features and enhancements designed to help you work more efficiently. Read on to discover everything that's new in Zoho ERP this
        • Fixed cost per task

          Is there any way to assign a fixed cost per task, but track time for internal reporting? Don't see a way to do this currently.
        • Please critique my CRM design

          I run a disability healthcare business with 2 business units. We run on Zoho One and are re-designing our CRM. We have developed the design concept ourselves, and I am hoping to get some critical feedback: 1) Noting that this is an early design of the
        • Set custom date creation for ticket using API in Desk

          Hi. all.. I want know if is possible to add ticket with custom creation date via API... This would to be great because we are moving from another platform to Zoho and we have need to keep all statistics for old tickets also. In api docs i didnt see nothing about custom date in ticket creation but i would prefer a confirm from comunity/support. Thank you P.S.: Sorry for bad english language
        • Allow Shopify / marketplace orders to be cloned

          Many businesses now use Shopify as a B2B ordering portal, not just a D2C ecommerce website. For B2B businesses, once these orders are imported into Zoho Inventory, Zoho often becomes the main system used to manage purchasing, stock, fulfilment and customer
        • How to Display a Logo Image on a Public Form?

          I would like to display a logo image in the header of a form. To achieve this, I added an Add Notes field to the form. The code below works perfectly for Zoho users accessing the form. However, when the form is made public, the image does not load properly:
        • Possible to define default font and size in Zoho Campaigns?

          Is it possible to define a default font (font, size and colour) for the text, H1 and H2 in Zoho Campaigns? For example: In a campaign, I add a text block, and the text is automatically century gothic, size 11, grey (6f6f6e) by default? Thank you!
        • Set Custom Colurs/Fonts/Style

          I know I can save blocks as books marks but it would be nice to be able to define a custom colour pallet, the style of the H1, H2 etc to save me having to copy a previous block and set them manually over and over again. Since the colour picker doesn't
        • Stop Zoho Projects From Automatically Adding Client Users

          I have a custom function that creates a Zoho Project for every Quote attached to a Deal when it moves to Closed Won. Everything works fine, except for the fact that connecting a Zoho Project to the CRM automatically takes the Contact associated with the
        • Zoho CRM - Kiosk Studio: Build Once, Execute Multiple Times with Loops

          Hello Everyone, Introducing Loop Functionality in Kiosk Studio. If you've ever built a Kiosk that needed to perform the same action multiple times like updating a list of contacts, scheduling calls for a batch of leads, or processing multiple products
        • Switching from Notebook to another product, too unreliable

          Not only is the spell check worse than useless, now there is a lag AFTER EVERY KEYSTROKE! This makes it impossible to use when there are innumerable products which provide this basic function. I made the mistake of relying on Notebook and have so many
        • Accidentally deleted a meeting recording -- can it be recovered?

          Hi, I accidentally deleted the recording for a meeting I had today. Is there a way I can recover it?
        • Next Page