Kaizen 254 - Building a Temporal Lead Score Decay System in Zoho CRM

Kaizen 254 - Building a Temporal Lead Score Decay System in Zoho CRM



Hello, CRM Wizards!

Welcome to a fresh week of Kaizen. 

In this post, we will build a temporal lead score decay system that works alongside your existing scoring rules by introducing percentage-based score decay driven solely by customer inactivity

By the end of this tutorial, you will have a Current Intent Score that reflects both customer engagement and its recency, enabling your sales team to prioritize leads with the strongest current buying intent.

Business Problem

Scoring rules evaluate customer activities against configured criteria and adjust scores whenever those conditions are met.

However, once a score is awarded, it generally remains until another qualifying activity changes it or the scoring conditions are evaluated again. This means the score does not naturally lose value simply because the customer has been inactive.

As a result, a lead that accumulated a high engagement score several days ago may continue to appear more valuable than a lead with more recent engagement, even though its current buying intent has declined.

Solution Overview

To address this, we will introduce a percentage-based temporal decay model that gradually reduces a lead’s score based solely on the customer’s inactivity period.
The solution separates engagement scoring from intent scoring.
  1. The Engagement Score continues to represent the customer’s latest engagement based on your configured scoring criteria.
  2. The Current Intent Score is derived from the Engagement Score and gradually decreases over time according to a the decay model whenever no new customer activity occurs.
It consists of four components:

Engagement Score

A custom field, updated by the scoring rule whenever a qualifying customer activity occurs. This represents the customer’s latest engagement score and serves as the base score for calculating temporal decay.

Current Intent Score

A custom field, that stores the score after applying percentage-based temporal decay. This is the score that sales representatives should always use to prioritize leads, as it reflects both the customer’s engagement and the time elapsed since the last qualifying activity.

Workflow 

Whenever the Engagement Score is updated, the workflow immediately copies its value to the Current Intent Score, ensuring that new customer activity instantly refreshes the lead’s current intent. 
It also records the timestamp in the Last Engagement Time custom field, which the scheduled function later uses to calculate the inactivity period for score decay.

Scheduled Function

Runs once every day to identify inactive leads, calculate the inactivity period, apply the quadratic decay formula, and update the Current Intent Score.
The Engagement Score serves as the source score maintained by the scoring rule, while the Current Intent Score serves as the operational score used by the sales team for lead prioritization.

Prerequisites

I. Create the Required Custom Fields

Create the following two custom fields in the Leads module using the Working with Custom Fields help page. 

Field
Data Type
Current Intent Score

String
Last Engagement Time

Date & Time



Make a Get Fields Metadata API to get the API names of these fields or go to Setup > Developer Hub > APIs and SDKs > CRM API > Leads to get the valid API names. 

Store the API names, it will be used later in the scheduled function. 

Notes
Note

The Engagement Score custom field can be created during the scoring rule configuration. This ensures that the field remains non-editable for users and cannot be modified through other actions.

II. Create a Connection

Refer to the Working with Connections help page for a step-by-step guide. 

Go to Setup > Developer Hub > Connections and create a connection for Zoho CRM service with the following two oauth scopes:
  1. ZohoCRM.modules.ALL
  2. ZohoCRM.coql.READ

Step 1 - Configure the Scoring Rule

Create a scoring rule that reflects your business requirements. For detailed instructions, refer to the Configuring Scoring Rules help page.

For this demonstration, we will create a scoring rule with a maximum score of 100.

Navigate to Setup > Automation > Scoring Rules and click the New Scoring Rule button.


Configure the scoring criteria based on your business requirements. 

For this example, we will use customer engagement activities supported by Zoho CRM, including:
  1. Emails: Opens, clicks, replies, and bounces.
  2. Calls: Incoming and outgoing call activities.
  3. Campaigns: Customer interactions with marketing campaigns.
  4. SalesIQ: Website visitor activities and engagement signals.
  5.  Any other customer engagement signals relevant to your sales process.

During the configuration, you will see the following option:
Would you like to add score fields to the records?
Click Yes, proceed.
Enter Engagement Score as the field name and choose Score from the adjacent dropdown.


Step 2 - Configure the Workflow

Next, create a workflow rule that executes whenever the Record Score is updated in the Leads module.

Refer to the Configuring Workflow Rules help page and Setting Field Updates help page for a step-by-step guidance. 

Go to Setup > Automation > Workflow Rules.
Create a workflow for the Leads module and apply it to all records. Under Instant Actions, add two Field Update actions.

Field Update 1: Last Engagement Time

Configure the first field update as follows:
  1. Field: Last Engagement Time
  2. Value to be updated: Static
  3. Select Execution Day from the calendar picker.
This stores the date and time when the Engagement Score was last updated due to customer activity.

Field Update 2: Current Intent Score

Create another field update and configure it as follows:
  1. Field: Current Intent Score
  2. Value to be updated: Reference
  3. Reference Field: Engagement Score
Whenever the Engagement Score changes, the workflow immediately copies its value to the Current Intent Score.


Since sales representatives always use the Current Intent Score to prioritize leads, this ensures that any new customer activity is reflected immediately instead of waiting for the next scheduled execution.
Save the workflow rule.

Step 3 - Create the Scheduled Function

The final step is to create a scheduled function that introduces percentage-based score decay during periods of inactivity.

For detailed instructions, refer to the Creating Schedules in Automation help page. 

Go to Setup > Automation > Schedules and click Create New Schedule

Configure the schedule to run once every day


The scheduled function performs the following operations.

Fetch the Eligible Leads

Execute a COQL query via invokeUrl task to retrieve the following fields such as Lead ID, Engagement Score, Current Intent Score and Last Engagement Time. 

Filter the records using the following criteria:
  1. Last Engagement Time is older than one day.
  2. Current Intent Score is greater than 0.
whereFilter = "Last_Engagement_Time < '" + cutoffDateTimeStr + "' AND (Current_Intent_Score is null OR Current_Intent_Score != '0')";
coqlQuery = "SELECT id, Engagement_Score, Current_Intent_Score, Last_Engagement_Time FROM Leads WHERE (" + whereFilter + ") LIMIT " + pageOffset.toString() + ", 2000";
coqlBody = Map();
coqlBody.put("select_query",coqlQuery);
info coqlBody.toString();
coqlResponse = invokeurl
[
type :POST
parameters:coqlBody.toString()
connection:"zylker_oauth_connection"
];
info coqlResponse;

Since the score decay operates only during inactivity, leads that have already reached a Current Intent Score of 0 do not require further processing. If a qualifying customer activity occurs later, the workflow immediately refreshes the Current Intent Score, making the lead eligible for future decay calculations.

If your organization contains more than 2000 records, paginate through the COQL response until all eligible records have been processed. In Deluge, this can be achieved using the leftpad() string function and pageOffsets.add() method (add()) on a list object together to process large number of records without writing nested loops. 

pageLoopList = "".leftPad(6).replaceAll(" ",",").toList().subList(0,6);
pageOffset = 0;
updateBatch = List();
for each el in pageLoopList
{
//Your code here
}

Info
For more details, find the complete working code in the CRM Kaizen Git Repository.

Calculate the Inactivity Period

For every lead returned by the COQL query, calculate the number of inactive days using the current date and time and the Last Engagement Time field.
You can use the built-in zoho.currentdate system variable to determine the current date.

Apply Percentage-Based Temporal Decay

The score decay is applied solely based on inactivity. No additional customer activity is required for the score to change.

For the demo, we will use a quadratic percentage decay model so that buyer intent decreases rapidly immediately after the last engagement and then tapers off over time.
The remaining score is calculated as:

Quote
remainingFactor = (1 - (inactiveDays / 5))²
Current Intent Score = max(0, Engagement Score × remainingFactor)

Where, inactiveDays is capped at 5 and the score reaches 0 after 5 inactive days.

For an engagement score of 100, the score progression would look like this:

Inactive Days

Remaining Factor

Current Intent Score

0
1.00
100
1
0.64
64
2
0.36
36
3
0.16
16
4
0.04
4
5
0.00
0

Update the Current Intent Score

After calculating the decayed score, use the Update Records API Deluge task to update the Current Intent Score for each lead. 

Notice that the Engagement Score remains untouched. It continues to represent the customer’s latest engagement, while the Current Intent Score represents the customer’s current buying intent after accounting for inactivity.

Let's Test!

Assume a customer performs a qualifying activity that results in an Engagement Score of 60 and triggered the workflow rule.

If no further qualifying activity occurs for the next two days, the scheduled function identifies the lead as inactive, calculates the inactivity period, applies the percentage-based temporal decay model, and updates the Current Intent Score to 22.


If the customer performs another qualifying activity before the next scheduled execution, the workflow immediately synchronizes the Current Intent Score with the latest Engagement Score, and the inactivity-based decay cycle starts again from the new Last Engagement Time.

The Current Intent Score complements your existing engagement scoring by introducing percentage-based temporal decay during periods of inactivity. This provides sales representatives with a score that reflects not only customer engagement, but also how recently that engagement occurred.

Although this example uses a five-day quadratic decay model, you can customize both the decay period and the decay formula to suit your business requirements.

Further Enhancements

The temporal score decay model presented in this demo uses a fixed decay curve for every lead. Depending on your business requirements, you can make the model more dynamic by introducing a decay factor into the calculation.

For example, the remaining factor can be calculated as:
Quote
remainingFactor = (1 - (inactiveDays / 5))² × decayFactor
This decay factor allows you to influence how quickly a lead’s Current Intent Score decays based on additional business context like territory, customer tier, product interest etc,. 

Scenario 1: Prioritize High-Value Leads

You can derive the weight factor from the Annual Revenue field to slow down or accelerate the decay for different categories of leads. For example, 

Annual Revenue

Decay Factor

Result
Less than $100K

0.8
Faster decay

$100K - $500K

1.0
Standard decay

Greater than $500K

1.2
Slower decay

Scenario 2: Decay Based on Lead Status

The Lead Status field can also influence the decay rate. For example, 

Lead Status
Decay Factor
Result
Attempted to Contact

0.8
Faster decay

Not Qualified

0.6
Much faster decay

Contacted
1.0
Standard decay

Pre-qualified

1.2
Slower decay


This enables your sales process to align score decay with the maturity of each lead. Leads that are already progressing through the sales funnel retain their intent score longer, while inactive or lower-priority leads gradually lose priority more quickly.

We hope you find this kaizen helpful.

Have questions or suggestions? Drop them in the comments or write to us at support@zohocrm.com.

On to Better Building!

----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
    • Sticky Posts

    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
    • Kaizen #256 - Build an Arrival Readiness Web Tab in Zoho CRM

      Hi everyone! Welcome back to the Kaizen series! In the post, we discuss a use case in hospitality industry: how an Arrival Readiness web tab widget can be used to let reception staff identify and resolve issues before arrival of guests. Use case In the
    • 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
    • Recent Topics

    • Zoho Publish is now available in Zoho One!

      Hello Zoho One users, We’re excited to announce that Zoho Publish is now included as part of the Zoho One suite! As businesses grow, keeping their business information accurate across online platforms can become challenging. Updates may be missed, details
    • How to change an employee mail id

      Hi, Does the administrator have the rights to edit an  employees mail id. 
    • Cousin Domain Verification in Zoho Mail: Identify and block look-alike domains

      Phishing attacks often rely on domain names that closely resemble legitimate ones. This makes it difficult for users to identify fraudulent emails at first glance. Zoho Mail's Cousin Domain Verification feature allows administrators to define trusted
    • How do I add 2 agents under the same email?

      I have 2 agents who use the same email address. I added one, but when adding the second agent, it says that the email is already registered. How do I configure this properly?
    • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

      Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
    • Updating an Invoice Line Item's Discount Account via API Call / Deluge Custom Function

      I need help updating an invoice line item's discount account via API. Below is a screenshot of the line item field I am referring to. Now the field to the left of the highlighted field (discount account) is the sales income account. I am able to modify
    • Collaborate Visually with Whiteboard in Zoho Projects

      Whiteboard in Zoho Projects allows you to collaborate visually by creating diagrams, annotating designs, and sketching project workflows using shapes, text, and images within project modules. Team members can work simultaneously, improving productivity
    • Associate project with timer on iPhone

      When I start the timer without first associating a project (on my iPhone), its starts fine but now when I need to associate a project, and click on the link, I get a list of EVERY project I've ever put into Zoho Books. It used to just show active projects.
    • Sales Tax Refund on Commerce Order

      I've looked high and low. Relatively new to ZOHO but not to systems in general. How do we produce a refund for sales tax charged and paid for by a customer in error? This does not impact inventory stock. Simply for accounting and getting the $ back to
    • Importing Chart of Accounts from Quickbooks -- "Debit or Credit"?

      I'm trying to switch from QB to Zoho Books. I've prepped my chart of accounts and put it into the format following the structure of the sample CSV file. But one thing that does not exist at all on the Quickbooks side is the Zoho column for "Debit or Credit".
    • Long term pricing for customers managing multiple organizations

      I've been using Zoho extensively for quite some time and genuinely think it's one of the most powerful and customizable business platforms available. Between Zoho Books and Zoho Analytics, I've invested a significant amount of time building automations,
    • Default Status for Appointments to Completed

      We use Zoho Bookings integrated with Zoho Desk to book time for tech support sessions, we've configured it to only allow for a contact to book a single session to avoid customers overbooking time that may not be needed. The trouble is, once a session
    • Customer User Fields for use in Rules

      Hi, I would like to be able to add custom fields to the users, such as Department or Role, which can then be used in Rules, Reports, etc. as a condition. A use case is limiting Global lists or Choices based on the users Custom Field, so one form can be
    • Add ZeptoMail to Zoho One

      Hi Zoho Team, I would like to request that ZeptoMail be added as a fully included application within Zoho One. Why this is important Zoho One is positioned as a unified business operating system that brings the applications an organization needs under
    • Item image on document

      I know what I am asking may not be possible, but I will ask anyway, maybe I will get lucky, and someone else is doing it. My business is based on special orders only from various online stores. When I send a quote to a client, I generate a separate quote
    • Dashboard Metric Drill-Down Shows Stale Data

      Summary: When clicking between different metric components on a custom dashboard, the drill-down list shows data from the previously opened metric instead of the one just clicked. Steps to Reproduce: Create a custom dashboard with multiple pre-defined/templatized
    • Zoho Marketing Automation WhatsApp Campaign Import Sync for Zoho Analytics

      WhatsApp is a critical channel in modern marketing, yet WhatsApp Campaign metrics from Zoho Marketing Automation currently cannot be natively imported into Zoho Analytics via the default advanced analytics connector. Integrating this into the standard
    • Allow Reauthorizing CRM Connections Without Revoking First

      Currently, when a Zoho CRM connection needs to be reauthorized or authorized with another account, we first have to revoke the existing authorization and then authorize it again. This creates a gap where the connection is unavailable, and any functions,
    • Programmatic Itemized Expenses?

      It does not appear that it is possible to create itemized expenses programmatically (via the API)? Is this correct, or am I misunderstanding the situation?
    • Prefix & Suffix on Single Line, Number, etc.

      Hi, I would like to have the same Prefix and Suffix that was added to the Unique ID on Text and Number Fields. Use case could be as basic as temperature, as per another Idea I have to use Single Line (Text) for a number that might have leading zeros today,
    • Handle Leading Zeros in a Number Field

      Hi, If I use a Number Field, set with Min 7 Digits and Max 7 Digits, and enter 0000001, it will result in 1 and an error as it removes the leading zeros, the same with entering 0012340 will result in 12340 and error. So I have to use a Text Field and
    • Is there a way to show contact emails in the Account?

      I know I can see the emails I have sent and received on a Contact detail view, but I want to be able to see all the emails that have been sent and received between all an Accounts Contacts on the Account Detail view. That way when I see the Account detail
    • Virtual Option for Fields

      Hi, I would like to be able to choose another option other than Read-Only or Disabled, such as Virtual. And with Virtual, the field is shown on the form and avilable in rules, but NOT saved to the Database. A use case is having multiple Large Lists of
    • Zoho Marketing Automation Cannot Sync Lookiup Fields

      Hello all, It seems that Zoho MA cannot sync Lookup fields from the CRM. Can you confirm if this is the case? Is there a workaround? Do you know if Campaigns can sync with custom modules and also with Lookup field in the CRM? Thank you!
    • Specific ListView Canvas on Canvas Home Page Always Loads Most Recent ListView, Not the One Specified

      I had mentioned this to ZOHO, but I mainly wanted to see if others in the Community are also facing this problem. I created a Canvas ListView for a Custom Module, and then created a Canvas Home page (technically on a tab item, but I'm not sure if that
    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
    • Zoho Campaigns EU Topics API returns HTTP 200 with empty topicDetails

      Hello, Our Zoho Campaigns EU organisation has two custom topics visible in the Campaigns UI, and contacts are subscribed to them. However, an OAuth request with ZohoCampaigns.contact.READ to https://campaigns.zoho.eu/api/v1.1/topics returns HTTP 200 with
    • Caso de Éxito: Cómo Toyota Financial Services unificó la atención al cliente con Zoho

      "Después de seis meses con el CRM en producción estamos encantados." Miriam Cárdenas, Responsable Departamento ATC Toyota Financial Services es la división financiera de Toyota encargada de gestionar la financiación de vehículos y, junto con KINTO España,
    • Zoho Books - France

      L’équipe de Zoho France reçoit régulièrement des questions sur la conformité de ses applications de finances (Zoho Books/ Zoho Invoice) pour le marché français. Voici quelques points pour clarifier la question : Zoho Books est un logiciel de comptabilité
    • Sending Zoho form link from custom function in Zoho CRM

      Hello,  We intend to send a Zoho form link to certain Contacts using a custom function. The Zoho Form must be pre-filled with the Deal information and contacts receiving it should be able to modify the values and upon submission, those modifications must
    • Automatically remove commas

      Team, Please be consistent in Zoho Books. In Payments, you have commas here: But when we copy and paste the amount in the Payments Made field, it does not accept it because the default setting is no commas. Please have Zoho Books remove commas autom
    • 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
    • Zoho CRM

      Cuándo voy a adjuntar un archivo .pdf en un registro en el campo Archivo obtengo el siguiente error:
    • Can I hide some products from a particular customer

      HI I want ot give a customer access to the portal but I need to hide some products from them that are not available for them to buy- is this possible ?
    • Dashboard/Component filter by probability

      Hi all Can I request the ability to add a Component or Dashboard filter for Deal Probability? Would be useful to be able to see data of deals more than 60% probable. Olly
    • Admin Logging in as another User

      How can a Super Admin login as another user. For example, I have a sales rep that is having issues with their Accounts and I want to view their Zoho Account with out having to do a GTM and sharing screens. Latest Update (27th April 2026): With the early
    • OpenAI Is Moving to the Responses API: Here's What It Means for SalesIQ

      OpenAI has deprecated its Assistants API and is moving to the Responses API. If you're using OpenAI Assistants with SalesIQ, you may be wondering if you need to make any changes to your existing setup. You don't. SalesIQ has already taken care of the
    • Free webinar: Zoho Sign for Microsoft apps

      Hello, Did you know Zoho Sign works right inside the Microsoft apps you already use? A signature request shouldn't mean leaving Teams for another tab, or downloading an Outlook attachment just to sign it. Zoho Sign integrates with Microsoft 365, Teams,
    • Billing Status and WO Status Field Colors -

      Hello Team, I noticed that the colors of the Billing Status and WO Status fields in the WO module have been changed. (Org ID:170000078905) This is not urgent to correct, but I wanted to bring it to your attention so you can check whether this is a system
    • Introducing throw statements in Deluge

      Hello everyone, We're introducing a powerful addition to Deluge that gives you more precise control over error handling in your scripts. Whether you're calling an external API, validating user input, or enforcing a business rule, there are moments when
    • Next Page