Ever wanted to run a Levenshtein Distance algorithm inside Zoho Deluge? No? Me neither, but I did it anyway.
I built a fully functional fuzzy matching system inside Zoho, brute-forcing a dynamic programming solution using Maps and recursive list generation.
- Does it scale? Not really.
- Does it work? Absolutely.
- Did I need to do this? Not at all, but it was fun.
I don’t even use this anymore because I found a better way around fuzzy matching for my needs, but hey, if you ever need a low volume Levenshtein calculator inside Zoho, now you have one. 🤷♂️
How It Works
The function computes Levenshtein Distance, a metric for fuzzy string similarity, by calculating the number of insertions, deletions, and substitutions needed to convert one string into another.
This method is commonly used in spell-checking, DNA sequencing, and fuzzy search algorithms—so obviously, I decided to implement it inside Zoho, because why not?
🔹 The Challenge: Zoho doesn’t support 2D arrays natively.
🔹 The Solution: I brute-forced it using Map-of-Maps as a manual matrix.
🔹 Bonus: I even used recursion to generate number sequences (which is completely unnecessary but kinda cool).
Code & Example Usage
Main Function: standalone.levenshteinDistance
📌 Input: {"s": "kitten", "t": "sitting"}
📌 Output: "3"
Code:
string standalone.levenshteinDistance(Map args)
{
// Retrieve input strings.
s = args.get("s");
t = args.get("t");
m = s.length();
n = t.length();
// If one string is empty, return the length of the other.
if(m == 0)
{
return n.toString();
}
if(n == 0)
{
return m.toString();
}
//info "Length of s: " + m.toString() + ", Length of t: " + n.toString();
// ------------------------------
// Get index lists via the helper function.
// The helper function standalone.UtilitygetListOfLength returns a comma-separated string.
// For example, if (m+1) is 5, it returns "0,1,2,3,4".
// ------------------------------
indices_m_str = standalone.UtilitygetListOfLength({"myLength":m + 1});
indices_n_str = standalone.UtilitygetListOfLength({"myLength":n + 1});
//info "indices_m_str: " + indices_m_str;
//info "indices_n_str: " + indices_n_str;
// Convert these comma-separated strings into lists of long values.
indices_m = list();
numList_m = indices_m_str.toList(",");
for each numStr in numList_m
{
if(numStr.trim() != "")
{
indices_m.add(numStr.trim().toLong());
}
}
indices_n = list();
numList_n = indices_n_str.toList(",");
for each numStr in numList_n
{
if(numStr.trim() != "")
{
indices_n.add(numStr.trim().toLong());
}
}
//info "indices_m list: " + indices_m.toString();
//info "indices_n list: " + indices_n.toString();
// ------------------------------
// Initialize matrix as a map-of-maps.
// Each row is a map keyed by the column index.
// ------------------------------
matrix = Map();
for each i in indices_m
{
rowMap = Map();
for each j in indices_n
{
rowMap.put(j,0);
}
matrix.put(i,rowMap);
}
// Set up the first column: matrix[i][0] = i.
for each i in indices_m
{
rowMap = matrix.get(i);
rowMap.put(0,i);
}
// Set up the first row: matrix[0][j] = j.
firstRow = matrix.get(0);
for each j in indices_n
{
firstRow.put(j,j);
}
// ------------------------------
// Compute Levenshtein distances.
// ------------------------------
for each i in indices_m
{
if(i == 0)
{
continue;
}
for each j in indices_n
{
if(j == 0)
{
continue;
}
// Determine cost: 0 if characters are the same, otherwise 1.
if(s.subString(i - 1,i) == t.subString(j - 1,j))
{
cost = 0;
}
else
{
cost = 1;
}
deletion = matrix.get(i - 1).get(j) + 1;
insertion = matrix.get(i).get(j - 1) + 1;
substitution = matrix.get(i - 1).get(j - 1) + cost;
minValue = deletion;
if(insertion < minValue)
{
minValue = insertion;
}
if(substitution < minValue)
{
minValue = substitution;
}
rowMap = matrix.get(i);
rowMap.put(j,minValue);
}
}
result = matrix.get(m).get(n);
//info "Levenshtein distance: " + result.toString();
return result.toString();
}
Recursive Helper Function: standalone.UtilitygetListOfLength
📌 Input: {"myLength": 6}
📌 Output: "0,1,2,3,4,5"
Code:
string standalone.UtilitygetListOfLength(Map args)
{
myLength = args.get("myLength");
//info "Input myLength: " + myLength;
if(myLength == null || myLength <= 0)
{
//info "Base case reached (myLength <= 0). Returning empty string.";
return "";
}
else
{
// Recursively get the string for (myLength - 1)
prevStr = standalone.UtilitygetListOfLength({"myLength":myLength - 1});
//info "Previous string returned for myLength " + (myLength - 1).toString() + ": " + prevStr;
if(prevStr.equals(""))
{
result = "0";
}
else
{
result = prevStr + "," + (myLength - 1).toString();
}
//info "Returning result for myLength " + myLength.toString() + ": " + result;
return result;
}
}
This helper function is completely unnecessary, but I made it anyway. Instead of just looping, it recursively builds a CSV string of numbers—which is both inefficient and hilarious. 😆
Why Did I Do This?
Because it wasn't supposed to work—but it does.
- Zoho doesn’t support Levenshtein distance? I built it anyway.
- Zoho doesn’t have fuzzy matching? Now it does.
- Zoho doesn’t support 2D arrays? I brute-forced a matrix using Maps.
- Does this scale for massive data? Nope, but it’s perfect for low-volume cases.
Thoughts? Ideas? Have you ever done something in Zoho just because you wanted to see if it was possible? Let me know. 😆
TL;DR:
📌 I brute-forced Levenshtein Distance into Zoho
📌 Zoho wasn’t built for this, but I made it work anyway
📌 Does it scale? No. Does it work? Yes.
📌 Do I use it? Nope. Was it fun? Absolutely.
Let me know what you think! 🚀
Recent Topics
Change default "Sort by"
Is there a way to change the default "sort by" when searching across modules?" in Zoho CRM? Currently the default sort method is "Modified time" but i would like to utilize the second option of "relevance" as the sort by default and not have to change
Create project (flow) and assign to person without account (company)
Hi Zoho Support & Community, I'm trying to automate a process using Zoho Flow to create a Zoho Project and link it directly to a Zoho CRM Contact. This reflects our B2C workflow where we primarily deal with individual Contacts, not Companies/Accounts.
Forte's Extra Costs
Hello everyone in the Zoho community, I wanted to share some information about Forte in case anyone wanted to look into them as a processor. I currently use Stripe, but wanted to use Forte's ACH to pay vendors and take ACH payments for our products. This is one of the only ACH processors that Zoho accepts. They state their cost is $25/month plus their transaction fees for ACH. However, after signing up and going through their approval process, I found this out they work with a PCI compliance service
Can Zoho CRM JS SDK Send Notifications, Create Tasks & Calendar Events?
Hello everyone! I’m just starting to explore this topic, so please excuse my beginner-level questions! Is it possible to use the JS SDK (https://help.zwidgets.com/help/latest/index.html) to: Send messages (signals, notifications) to specific employees,
Restricting Printing
Hi Is it possible to stop users printing documents?
Backup and Restore of Projects
Hi Guys, my boss asked me "do we store regulary offline Backups of Zoho Projects" and i could only answer "no way". Is there really no way to backup and restore a project manualy? As Projects is the main Product we decided to use Zoho it could be that
Enable Zia Bot for Intelligent Conversations in Zoho Cliq
Hi Zoho Cliq Team, We would like to request a new feature: the ability to interact with Zia via a dedicated bot in Zoho Cliq, in a way similar to how users interact with GPT-based assistants. Use Case: We're looking for functionality beyond the existing
Zoho RPA is now available in your Zoho One bundle!
Hello All! Of late, it's been quite a stint of new app integrations in Zoho One. This announcement pertains to the addition of another Zoho application, the most sought-after Zoho RPA - Robotic Process Automation, to the bundle. What is Zoho RPA? Zoho
Data types in custom fields
Hi, I've been trying to create a custom field to enter purchase order dates , but there is only one data type in the drop down to choose from which is a "Text Box ( Single Line )". I need the "Date" Data type. Please give me a solution regarding thi
Change rate after xxxx kilometers
Is there a way to change the miileage rate after a certain mileage. After 5000 kilometers, we want the rate to automaticly change. Thank !
Sync desktop folders instantly with WorkDrive TrueSync (Beta)
Keeping your important files backed up and accessible has never been easier! With WorkDrive desktop app (TrueSync), you can now automatically sync specific desktop folders to WorkDrive Web, ensuring seamless, real-time updates across devices. Important:
Can't attach
I am having problems sending attachments. I am trying to attach some PDFs to an email (as I do several times every day) but the progress bar on the attached file gets stuck somewhere between 20%-70% and when I hit send I get the error message 'Attachment
WhatsApp Channels in Zoho Campaigns
Now that Meta has opened WhatsApp Channels globally, will you add it to Zoho Campaigns? It's another top channel for marketing communications as email and SMS. Thanks.
Existing subform data is being changed when new subform entries are added
I'm having trouble with existing subform data being changed when new subform entries are created. I have the following setup to track registrations for a girl scout troop: Main Form: Child Subform: Registrations The data are a one-to-many relationship where each Child record has many Registrations (new Registration will be created for each year the child is in the troop.) Per the instructions, I have created the subfom, added it to the main form, gone back to the subform and created the bi-directional
Bigin: filter Contacts by Company fields
Hello, I was wondering if there's a way to filter the contacts based on a field belonging to their company. I.e.: - filter contacts by Company Annual Revenue field - filter contacts by Company Employee No. field In case this is not possibile, what workaround
Button on Deal screen to automate changing deal dates?
Hi I spend a lot of time working with our accounts managers here moving deals around the calendar, qualifying things etc. I'd like to have an easy way to change the closing date on a deal, from the deal screen table, rather than either click in to the
Attention API Users: Upcoming Support for Renaming System Fields
Hello all! We are excited to announce an upcoming enhancement in Zoho CRM: support for renaming system-defined fields! Current Behavior Currently, system-defined fields returned by the GET - Fields Metadata API have display_label and field_label properties
How to authenticate my domain on ovh
I don't succeed in adding an domain authentification on ovh. Should i first create a subdomain? But this doesn't work either, ti gi ves te same screen and the next button is greyed out when adding the info received from zoho
Undelivered Mail Returned to Sender
commerciale@etruriadesign.it, ERROR CODE :550 - "The mail server detected your message as spam and has prevented delivery." I have been corresponding with the receiver and they wrote "Ciao, ho fatto verificare ma purtroppo non è un problema che deriva
Kaizen #190 - Queries in Custom Related Lists
Hello everyone! Welcome back to another week of Kaizen! This week, we will discuss yet another interesting enhancement to Queries. As you all know, Queries allow you to dynamically retrieve data from CRM as well as third-party services directly within
Notifications no longer being sent to my email address for any scheduled events
The last few weeks, I stopped receiving email notifications to my email for events I have scheduled and have a selected reminder option checked.
This domain is not allowed to add. Please contact support-as@zohocorp.com for further details
I am trying to setup the free version of Zoho Mail. When I tried to add my domain, theselfreunion.com I got the error message that is the subject of this Topic. I've read your other community forum topics, and this is NOT a free domain. So what is the
Group to shared mailbox conversion
Is it possible to convert a group in Zoho mail to a shared mailbox?
Mail Merge Stuck in Queue
I am trying to send Mail Merge's and it never sends out to the full list. It always hits a portion and the rest remain in the "Queue" - the emails I am sending are time sensitive, so I need this to be resolved or have a way to push the emails through
why do I get error message each time I open zoho mail
why do I get error message each time I open zoho mail
Cross-department Parent-Child ticketing for faster and efficient ticket resolution
Hello everyone, Organizations frequently need to have multiple departments set up in their customer service ticketing system. However, when a customer raises an issue or an internal process that requires agents to collaborate with their peers, a lack
Can't setup email on outlook (Android Phone)
Dear All Support, I have tried many time to setup this zoho mail over the android phone (outlook app) . But it's always show me to check username/password of my email . But i can login from the webmail , that's why i confuse , How can i able to access
Having problem with MX records and SPF
Hi there, I have been facing a problem that my zoho mail doesn't receive mail. See Error in below The MX Records of your domain(s) mydomain.com are not pointed to Zoho and you may not receive emails in Zoho SPF entries in your domains DNS are not configured
ZOHO Mail App Not working
There seems to be an issue with Zoho Mail App today. It is not connecting to server, internet is working fine, tried uninstalling app and reinstalling, loading circle keeps spinning round. Is there an update on the way?
Account with own domain, IMAP vs IMAPPRO
Hi, I have email account with my own domain. I use Em Client email plan and when I use IMAPPRO incoming host, email comes in Em Client only when I restart program. If I use IMAP incoming host everything is ok. Port is 993 both option. Why so? What´s different
Automatic Display the Price from CPQ
Is it possible to display the discounted price from CPQ that I created for my customer? For example, when the customer selects Product A, instead of showing the default price, it should display the discounted CPQ price.
Enhancement - Financial Reports
Hello Everyone, As part of enhancing reports in Zoho Books, we have added an option`Compare With` in Financial reports. Using this, you can compare the current period with Previous Year(s)/Previous Period(s) (Maximum 3 periods). This option is available in the following Financial Reports: * Profit and Loss * Cash Flow Statement * Balance Sheet Please feel free to share your feedback. We are glad to hear from you. Regards, Nithya - Zoho Books Team.
Associating Multiple Work Orders with a Single Invoice in Zoho FSM
Hello Everyone, Is it possible to associate multiple Work Orders with a single Invoice in Zoho FSM? Best Regards, Subhash Kumar
Sent emails not going and showing "Processing"
Hello Team, Could you please assist with sent emails showing "processing" and not actually going through? Many thanks and regards, Cycology
Free Plan mail accounts details
In the zoho mail pricing there's a free plan that includes: FREE PLAN Up to 25 Users 5GB* /User, 25MB Attachment Limit Webmail access only. Single domain hosting. I need to make sure that I'm able to create multiple email accounts in the form of: name@domain.com
Spf cannot verify
Hello, Thank you for your service. I am not able to configure my SPF. I have follow several times your instructions but it does not work. I cannot verify. My domain is ptjpt.co.id Please help me
Custom Function : Copy multilookup field to text field
Hi, I'm a newbie on function programming, I try to copy text from a multi lookup field named "societe" to a text field named "societe2". I've used this code. In deluge script it seems to work, but when I trigger this function it doesn't work (Societe2
Introducing Global Sets for easy management of similar picklists in CRM
[Update | Sep 2024] We've increased the maximum count limit for global sets. These new limits are now live for AU and JP data centers and will be gradually opened to all. Please check this link for the updated limits. Hello folks, As administrators who
TikTok (and other social platform) Messages and comments of the past
When I link a social channel, Zoho will show in "Inbox", "Messages" and "Contact" sections the interaction done in the past? (comment, messages...)
Announcing Zoho Community Developer Bootcamps in India – Extensions
Hey everyone! We're back with another line-up of Zoho Community Developer Bootcamps in India! Following the success of the first leg of bootcamps on Extensions, we're now ready with the second leg. These bootcamps focus on empowering developers of all
Next Page