Custom Function : Updating Lead Score.

Custom Function : Updating Lead Score.

Scenario: Updating Lead Score.


You may want to rank the leads in your CRM account in order to determine their sales-readiness. The scoring can be based on certain predefined values. This lead scoring can be done with custom functions.

You can have a
custom field for the Score and use custom functions to update the Lead Score based on certain values. When you update the fields in leads, the score will be updated automatically.

 

This custom function can also be used for other modules by making small changes in the custom function.

Please follow these steps:

  1. Log in to Zoho CRM with administrative privileges.
  2. Click Setup > Automation > Workflow > Create Rule.
  3. In the New Rule page, choose Leads module from the drop-down list and provide other rule details.
  4. Under Execute On, choose Create or Edit and then click Next.
  5. Specify the Rule Criteria. The rule will triggered only when a record meets the criteria mentioned here.
  6. In the Actions section, click on the Add button for Call Custom Functions.
  7. In the Configure Custom Function popup, click Write your own.
  8. Specify a name for the function.
  9. Build the Deluge Script based on the code given below.
void workflowspace.LeadsScoring(int Leadid,string Scorefield)
{
leadIDStr=input.Leadid.toString();
resp = zoho.crm.getRecordById("Leads",input.Leadid);
respStr=resp.toString();
respMap=respStr.toMap();
phone=ifnull(respMap.get("Phone"),"0"); 
email=ifnull(respMap.get("Email"),"0");
title=ifnull(respMap.get("Title"),"0");
website=ifnull(respMap.get("Website"),"0");
industry=ifnull(respMap.get("Industry"),"0");
point=0;
if(phone.length()  >  9)
{
point=2;
}
if(!((email.contains("gmail")  ||  email.contains("yahoo"))  ||  email.contains("outlook")))
{
point=(point  +  2);
}
if((website  !=  null)  ||  (website  !=  ""))
{
point=(point  +  2);
}
if(((title.contains("CEO")  ||  title.contains("manager"))  ||  title.contains("dir"))  ||  title.contains("VP"))
{
point=(point  +  2);
}
if(industry.contains("ERP"))
{
point=(point  +  2);
}
/////////////////////////////////////
info point;
if(point  >=  9)
{
Score="*****";
}
else if(point  >=  7)
{
Score="****";
}
else if(point  >=  5)
{
Score="***";
}
else
{
Score="";
}
info Score;
upresp = zoho.crm.updateRecord("Leads",leadIDStr,{ input.Scorefield : Score });
//info upresp;
}
Note: This custom is for the leads module and you can change the custom function for other modules also.

Please refer to the following link to know more about this feature:

Sincerely,
Prakash

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

                                                              Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
                                                            • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

                                                              Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
                                                            • Custom Function : Automatically send the Quote to the related contact

                                                              Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
                                                            • Function #50: Schedule Calls to records

                                                              Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
                                                            • Function #37: Create a Purchase Order from a Quote

                                                              Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Zia Sentiment and Functionality on Mobile

                                                                                                              Please add Zia sentiment and generative responses to the mobile app. It would be nice to see the ticket sentiment and generate a response back to a user using Zia on my iPhone
                                                                                                            • View Account Attachments on iOS

                                                                                                              Please allow us to view account attachments on the mobile iOS app!
                                                                                                            • How do I run a PnL by Sales Person?

                                                                                                              I am trying to run a PnL by sales person but am not seeing the option do so. All I need to know (per salesperson) is revenue, cost of goods, gross profit.
                                                                                                            • View Contracts and Support Plans on Mobile

                                                                                                              We would like to be able to see contracts and support plans from the mobile app on iOS!
                                                                                                            • Why is Zoho Meeting quality so poor?

                                                                                                              I've just moved from Office 365 to Zoho Workplace and have been generally really positive about the new platform -- nicely integrated, nice GUI, good and easy-to-understand control and customisation, and at a reasonable price. However, what is going on
                                                                                                            • App like Miro

                                                                                                              Hi all, is there a way to have a interactive whiteboard like in Miro? We want to visualize our processes and workflows in an easy way.
                                                                                                            • Loan repayment Entry

                                                                                                              While receiving loan, i does following steps in My Zoho books. 1. Create "Loan & Advance " Account as Parent Account under Long Term Liabilities. 2. Create another account For Example "Mr. ABC's Loan as Child account under the parent account. Now: In
                                                                                                            • Quotes module send email reverted back into 2022??

                                                                                                              Our Zoho CRM PLUS quotes, sales orders, invoice modules is showing us an email composer from 2022. We cannot send emails and its been a real pain. I tried clicking the new version over there but it doesnt seem to do anything. Any help is welcome. th
                                                                                                            • Workflow Condition - how do check that a date / time value is in the past?

                                                                                                              Hello, I'm got a workflow that runs a function when records reach their 'Effective Date / Time', but sometimes records are created after the 'Effective Date / Time' so I have another workflow that checks for records which needs to be processed immediately.
                                                                                                            • Pre filling SignForm field values by URL field alias's in Zoho Sign

                                                                                                              Hi, Does anyone know if it's possible to pre fill the field values of the SignForm by using field alias's like you can in Zoho forms? To be more specific, I want to be able to change the SignForm URL to include some information like this: Before : https://sign.zoho.eu/signform?form_link=234b4d535f495623920c288fc8538cb9e6db03bbfd44499b63f3e5c48daf78f44bc47f333e2f5072cc1ee74b7332fe18b25c93fab10cb6243278d49c67eacbf30bbe5b6e1cc8c6b2#/
                                                                                                            • How to Split Payout in Zoho Books (Without Using Journal?)

                                                                                                              Hi, I'm trying to properly record payouts in Zoho Books. The issue is that each payout is a combination of sales and expenses (fees). When I try to categorise the payout transaction from the Banking tab, I can only split the transaction using income-type
                                                                                                            • Payment Schedule

                                                                                                              Please add the ability to create a payment schedule. The other options, like retainer invoices or two invoices, do not work for the customer.  We invoice a client and need to be able to show them everything they owe in one invoice, and when each payment
                                                                                                            • Google Recaptcha V3

                                                                                                              Hi, Why, years later now, are we still waiting for Zoho Forms to incorporate Google Recaptcha V3 into it's systems? Come on Zoho this has been an ongoing issue for over a year now!! It should be a priority.
                                                                                                            • Which pricing system do you think would work best for us?

                                                                                                              Imagine we’re selling strictly wholesale. We’d rather not publish unit prices; instead, we quote customers case-by-case. To spur larger orders, we’re considering a transparent discount ladder—say: $0 – $999: 0 % $1,000 – $1,999: 5 % $2,000 – $4,999: 10
                                                                                                            • Add Support for Google reCAPTCHA v3 in Zoho Forms

                                                                                                              Hello Zoho Forms Team, We appreciate the security measures currently available in Zoho Forms, including Zoho CAPTCHA, Google reCAPTCHA v2 (checkbox), and reCAPTCHA v2 (Invisible). However, we would like to request the addition of support for Google reCAPTCHA
                                                                                                            • Can't Remove Payment Gateway

                                                                                                              I am getting the error "Settings cannot be cleared as some of the transactions are still in progress." when trying to remove the PayGate payment gateway which I was unable to get working. I am now using paystack and I want to remove Paygate.
                                                                                                            • Sync specific Zoho Inventory Warehouses to Zoho Commerce

                                                                                                              As said in the title, we would want to only sync stock from one warehouse of Zoho Inventory to the Zoho Commerce item stock. We have a 2 warehouses in different countries and the way that Zoho Commerce works (It takes stock from ALL WAREHOUSES EVERYWHERE
                                                                                                            • Weekly Tips : Automatically clean clutter with Junk cleanup interval

                                                                                                              If you regularly receive many unwanted or spam emails, your Spam folder can quickly fill up and start taking up valuable storage space in your Zoho Mail account. Instead of manually clearing it every few days, you might find it helpful to enable automatic
                                                                                                            • Any solution for getting portal users list in deluge or in widget

                                                                                                              Hi Team, Has anyone able to find the solution to get portal users list in deluge or in zoho creator widgets? Thanks, Payal
                                                                                                            • The Grid is here!

                                                                                                              Hey Zoho Forms Community! 👋 We’re thrilled to announce the launch of a feature that’s been on your wishlist for a while: Grids What is Grids? Grids let you place form fields side by side in multiple columns to create a more concise and organized form
                                                                                                            • Steuerberater der Zoho benutzt in Deutschland

                                                                                                              I write in English because the issue is related to German regulations. Wir sind ein Unternehmen, welches aktuell keine Pflicht zur doppelten Buchführung hat. Aktuell bucht unser Steuerberater jeden Beleg, auch unsere Auslagen. Wir würden dies gerne selbst
                                                                                                            • GraphQL in new Send Webhooks feature

                                                                                                              Hello, is it possible to use GraphQL apis in the new Send Webhooks feature?
                                                                                                            • # 2 Why do we need a billing system when accounting covers billing?

                                                                                                              In today's evolving financial tech stack, businesses use a mix of tools to manage their day-to-day operations, from invoicing to full-fledged accounting. While accounting platforms typically come with built-in invoicing features, specialized billing systems
                                                                                                            • How to insert an Excel/Zoho Sheet table in a chat?

                                                                                                              Hello, is there a way to paste an excel/zoho sheet table to a conversation without loosing table lines. I tried to paste a piece of a table and all the columns and rows were gone. How to easily paste a table without a need of sending a file? Katarzy
                                                                                                            • Mass Update Application Status

                                                                                                              How to update application statuses of Multiple Applications at once? Is that possible? If not then why please consider adding it It can save hours of manual work Thats the only Option I see
                                                                                                            • Free webinar: Streamlining customer service paperwork with the Zoho Sign extension for Zoho Desk

                                                                                                              Hi there! Wondering how to bridge the gap between digitized customer service and business paperwork? Attend our free webinar to learn how you can do this by connecting Zoho Sign, our digital signature app, with Zoho Desk, our online customer service help
                                                                                                            • Mail Search Not Working

                                                                                                              Hello, Mail search is not working at all. I've tried Chrome and Mozilla. I can try and search for an exact term, or even an email that is 1st in my email list. All search does is sit and spin, or it comes up with no results. I've also tried it on my android
                                                                                                            • Cannot Send Email to a Gmail Account

                                                                                                              Hello, I have a zoho-hosted email account, alex@chirochannelnetwork.com that has trouble sending to gmail accounts.  But not all gmail accounts, only some of them. I've tried to figure this out with clients, and they don't appear to be going into their
                                                                                                            • Unblock ME

                                                                                                              info@pentekykloi.gr Unable to send message;Reason:554 5.1.8 Email Outgoing Blocked. Learn more. I purchase additional storage
                                                                                                            • The Social Wall: July 2025

                                                                                                              Hello everyone! July has brought some exciting new updates to Zoho Social. From powerful enhancements in the Social Toolkit to new capabilities in the mobile app, we’ve packed this month with features designed to help you level up your social media presence.
                                                                                                            • Cannot Print Landscape with Zoho Sheet

                                                                                                              I am noticing that when using the Zoho Sheet desktop for Mac, that even when selecting landscape as the print option, once you choose "Print", a second system dialog opens that automatically makes the view portrait again, and does not allow printing in
                                                                                                            • Power of Automation : Enhancing custom date field calculations by excluding Weekends and Holidays

                                                                                                              Hello Everyone, A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:
                                                                                                            • Stock count by bin location

                                                                                                              Is there a configuration to make a stock count by bin or area and not by product. these is useful to manage count by area Regards
                                                                                                            • Temporary Outage in Zoho Cliq Affecting US Users – July 23, 2025

                                                                                                              We experienced a service disruption in Zoho Cliq that impacted core functionality for users in the US region. The issue occurred between Jul 23, 2025, 06:54:00 PM IST and 07:13:13 PM IST, lasting approximately 19 minutes. To restore service stability,
                                                                                                            • portal.assignUserInProfile - Não esta adicionando

                                                                                                              Estou encontrando problema com este comando portal.assignUserInProfile Não esta incluindo o usuário no portal Alguém pode me dizer o que pode ser thisapp.portal.assignUserInProfile("teste@gmail.com","Customer");
                                                                                                            • CRM emails vs Campaigns

                                                                                                              Please help me understand this. I am having a difficult understanding of "Campaigns" sent through CRM (real emails) or Zoho One (blast "potentially junk" emails) This is what I currently think emails sent via CRM are "real" emails sent through linked real personal email accounts and therefore are more likely to get delivered.  We use this for critical updates for our "Approved " accounts and certain other preferred statuses emails via Campaigns are sent through the Zoho server (like MailChimp, Campaign
                                                                                                            • Setting up property management in Zoho Books

                                                                                                              Hi, I run a property management business that manages property complexes. There are multiple owners, some owning more than one property on the same complex. My role is to manage the fees they pay for maintenance of common areas, such as the swimming pool
                                                                                                            • Reverse proxy

                                                                                                              We have a web application in the creator platform. When I launch a particular DNS, I would like that DNS to redirect to the web page of the application in creator app. Has anyone achieved it and if yes, please share how to do it.
                                                                                                            • Still client need to download .exe?

                                                                                                              Hello, the client for use zoho assist need everytime download .exe file and launch it?
                                                                                                            • Splitting a ticket's entire thread

                                                                                                              Hi, When you split a ticket it only splits the individual reply that you clicked "Split as new ticket" on. Is it not possible to split the entire ticket thread from that point into the new ticket (every reply from the split point forward)? Or is there
                                                                                                            • Next Page