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

                                                                                                            • Maxima Address on FSM Customer

                                                                                                              Im trying to add probably 50 customers from one company but couldn't make it since it has limit..how do i add the limit?
                                                                                                            • How to Track Inventory Usage from Zoho FSM to Zoho Inventory?

                                                                                                              Hi everyone, We’re currently working on integrating Zoho FSM with Zoho Inventory, and we’ve encountered a challenge we’re hoping the community can help us understand better. Here’s the context: When we create a Work Order in Zoho FSM that involves parts
                                                                                                            • View subform entries without viewing a record in Zoho CRM | Kiosk Studio Session #8

                                                                                                              In a nutshell Have you ever wanted to take a quick peek at a record's subform? Examples might be invoiced items in an invoice, ordered items in a sales order, or purchased items in a purchase order. Let's say you're viewing your list of invoices in Zoho
                                                                                                            • How to Create a YTD vs Last YTD Comparison Report in Zoho Analytics?

                                                                                                              Hi everyone, I'm trying to build a report that compares Year-to-Date (YTD) metrics from this year to last year. I’m struggling to get accurate results using custom formulas or aggregate functions. Has anyone successfully created a YTD vs LYTD comparison
                                                                                                            • Transforma tu Inventario: Control Inteligente y Funciones Clave en Zoho Inventory (Spanish Webinar)

                                                                                                              ¿Tu empresa necesita mayor trazabilidad y control en almacenes? Conoce cómo gestionar tu inventario con eficiencia y automatización... ¡y descubre las sorpresas que trae Zoho Analytics! Participa en nuestro webinar gratuito en español, este 19 de agosto
                                                                                                            • Dashlane discontinued its free plan: Here's why Zoho Vault's free plan is worth the switch

                                                                                                              Hey everyone, Dashlane password manager has officially announced that its free plan will be discontinued starting September 16, 2025. This change means that current free users will need to either upgrade to a paid subscription or export their data and
                                                                                                            • Mails are not being sent from custom Deluge function

                                                                                                              We are having troubles to implement sending Invoices / Sales_Orders etc. automatically using following deluge script: attachment_template_id = "aaaa"; record_id = "bbbb"; mail_template_id = "cccc"; //NEW aproach fileUrl = "https://www.zohoapis.com/crm/v8/settings/inventory_templates/"
                                                                                                            • Currency transition

                                                                                                              We are using Zoho CRM in Curacao, Dutch Caribbean. Our currency is currently the ANG. Curacao will be transition ing from using the ANG (Antillean Guilder) to using the XCG currency (Caribbean Guilder) on March 31st 2025, see: https://www.mcb-bank.com/caribbean-guilder.
                                                                                                            • Notes and Attachments visibility can now be restricted based on profiles

                                                                                                              Dear All, We hope you're well! We are here with a quick update about Notes and Attachments profile permissions. In the past, a record's Notes and Attachments were visible by default to all users with record access. However, as notes and attachments can
                                                                                                            • Zoho webinar--hard for agencies

                                                                                                              So, this is just a dive into our use case, and why we've been disappointed in Zoho webinar. We are a small marketing agency, and we wanted to add webinars to the services we provide, as many of our clients want to learn to use them as part of their content
                                                                                                            • Celebrating Raksha Bandhan with Zoho Desk: A Bond of Trust, Protection, and Service

                                                                                                              Raksha Bandhan, celebrated across India, symbolizes the sacred bond of protection and affection between siblings. “Raksha” means protection, “Bandhan” means bond or knot: together, it represents a knot of care and security. On this occasion, we'd like
                                                                                                            • Banking > Import statements with a csv file

                                                                                                              Good morning, I am regularly using the "import statement" option to match my transactions. I've been using csv files produced by my bank online and was able to import my transactions. Until now. Thank you for your help for fixing this ! Alex.
                                                                                                            • ZOHO BOOKS - RECEIVING MORE ITEMS THAN ORDERED

                                                                                                              Hello, When trying to enter a vendor's bill that contains items with bigger quantity than ordered in the PO (it happens quite often) - The system would not let us save the bill and show this error: "Quantity recorded cannot be more than quantity ordered." 
                                                                                                            • Has anyone successfully added Microsoft Graph API Oauth2 as a connection?

                                                                                                              I'm having trouble getting Microsoft Graph API created as a connection in zoho crm. Has anyone successfully added Microsoft Graph API Oauth2 as a connection? My issue is not necessarily on the Zoho side, but understanding how to set up the Microsoft side
                                                                                                            • Syncing Timesheets between Projects and Desk

                                                                                                              All users able to see their own timelog entries from all apps in one place, synced immediately. All managers able to view total/all time entries from one place. This is something that has come up for us and multiple clients. Example: we have a client
                                                                                                            • Spell Check default language

                                                                                                              Hello All, Is it possible to set the Spell Check default language? I can't find it in the settings. Thanks a lot! Levente
                                                                                                            • Zoho Backstage 3.0 - Boostez vos événements avec des outils malins

                                                                                                              Zoho Backstage vous accompagne dans l’organisation d’événements réussis, avec des outils qui simplifient la planification, optimisent l’exécution et renforcent la connexion avec votre public. La version 2.0 a apporté une nouvelle interface, plus de flexibilité
                                                                                                            • Portal user activity reporting

                                                                                                              Aside from the metrics section in the admin dashboard, is there a way to view/create reports for portal user activity? Im looking for a more granular option to see exactly what users are utilizing the portal. Thanks!
                                                                                                            • Automation #11 - Auto Update Custom Fields with Values from Emails

                                                                                                              This is a monthly series designed to help you get the best out of Desk. We take our cue from what's being discussed or asked about the most in our community. Then we find the right use cases that specifically highlight solutions, ideas and tips to optimize
                                                                                                            • Admins to set Agents Picture

                                                                                                              Admins should not have to rely on agents to set a nice profile picture for them. Admins get the headshot pictures from HR and should be able to upload and set their picture, not rely on them to: 1) upload a picture at all 2) upload a good picture 3) upload
                                                                                                            • Time Tracking Reporting and Billing

                                                                                                              I wish for the time tracking module to be enhanced further. Currently it is independent of Support Plans and Contracts. Support Plans and Contracts are also mostly separate. We need a better dashboard of this with the ability to natively mark billed or
                                                                                                            • Enhanced Email Signature Folding

                                                                                                              We have departmental signatures setup which are great, however, when viewing ticket details, it gets very overwhelming when scrolling though threads and conversations where you scroll past ten different signatures of your own team, then ten signatures
                                                                                                            • How to add formatting in zoho.cliq.postToUser(...) message?

                                                                                                              In a CRM Deluge function, I'm trying to use the message formatting guidelines given here: https://www.zoho.com/deluge/help/cliq/posting-to-zoho-cliq.html#message-formats My message is: message: #Title text. The result in Cliq is: #Title text. (no large
                                                                                                            • How to add line breaks in zoho.cliq.postToUser(...) message?

                                                                                                              In a CRM function using Deluge I'm sending this message and attempting to add some line breaks but they are ignored. Is there another way to add these breaks? My message: message: New urgent task\nDescription \nThis is a fake description.\n A new line?
                                                                                                            • Zia Agents/End of Day Reports

                                                                                                              As a manager or owner it would be nice if Zia analyzed today's (or this week's tickets) and gave an end of the day report to management team. - what important tickets were worked on or submitted today? - what agents were unproductive today and answered
                                                                                                            • Project Cost Tracking

                                                                                                              I see there are questions/concerns that Zoho doesn't track costs to a tasks in a project. We are a manufacturer and are in the early stages of tracking costs to project. I would like to expand out the COGS Chart of accounts in Books and record costs via
                                                                                                            • How to record if the payment made is return due to transaction failed.

                                                                                                              So there is Bill of $2000, and a payments made transaction to clear the bill. The amount is actually deducted from bank account. However, a few days later, I found the bank returned only $1750 cause there are $250 bank service charge for this failed transaction.
                                                                                                            • Help Center Customization UI

                                                                                                              The customization screens for the help center needs the UI improved. It looks straight out of 2004. The Zoho Desk normal UI is great. All it takes is uniform fonts and colors across all parts of the tool... I compare this to Zendesk Guide.
                                                                                                            • Este domínio já está associado a esta conta

                                                                                                              Fui fazer meu cadastro na zoho e quando digitei meu domínio recebi essa mensagem que meu domínio estava associado a uma conta que eu nem faço idéia de quem seja. Como que faço pra resolver isso? Atenciosamente, Anderson Souza.
                                                                                                            • I need some help in Expenses Per Diem Policy

                                                                                                              this is my script written for restricting the PerDiem Components. Say if Lodging and Per Day Allowance both is selected from Per Diem Page then the report should gets auto rejected. When Im trying to executing it says the following error {"code":11,"message":"The
                                                                                                            • Adding Photos to Dashboards on Zoho Analytics

                                                                                                              I am creating a dashboard to showcase data from survey results from focus groups. I am creating a focus group participant profile tab where it is filtered by the name of the participant and showcases information about them using KPI widgets. I am running
                                                                                                            • What is the difference between Retainer invoice and Advance Payments?

                                                                                                              Retainer invoice seem like they are just advance payments with extra details. Instead of creating a Sales Order with order details, a retainer is created. It feels like they are a workaround to link advance payments with sales orders. Is there any advantage
                                                                                                            • Exporting record notes in bulk

                                                                                                              Hi team, Is it possible to bulk export the notes attached to a record? i.e to a CSV file or otherwise. Our use case is exporting all notes for our lead/account/Deal records. We have another system we'd like to import these notes to but I can't seem to
                                                                                                            • Field customization

                                                                                                              Hi Team Good day! I am a commission agent who sell and purchase goods from vendors, while in purchasing invoices I am not able to deduct the expenses such as commission and other expenses on actual amount. Kindly help me to customize the invoice based
                                                                                                            • vendors / customers with 2 different address and gst no

                                                                                                              Why can't we have option for more than one address and depending on the state option for more than 1 GST no. ? We have customers / vendors PAN india with different addresses and GST no. for different states.
                                                                                                            • Error: Invalid Element gst_no, Invalid Element gst_treatment, Invalid Element place_of_contact

                                                                                                              so i am creating a new contact post request and i want add gst infomation when amount is above 50000 and if pass gst info in request body then i get this errors > Error: Invalid Element gst_no, Invalid Element gst_treatment, Invalid Element place_of_contact
                                                                                                            • Add multiple Billing Addresses under one GST number

                                                                                                              My client owns multiple businesses in various locations but they all come under one GST. Is there a way to add multiple billing addresses for the same GST? Managing this by adding multiple Shipping addresses is not an option. The client wants the GST
                                                                                                            • Zoho Mail API - Upload Attachment

                                                                                                              https://www.zoho.com/mail/help/api/post-upload-attachments.html I followed the steps from the API documentation and wrote a backend in JavaScript to send emails. Normal emails are sent without any problems. However, I can’t send emails with attachments.
                                                                                                            • Unable to create custom fields for shipment order

                                                                                                              I'm unable to create custom fields for shipment orders, even though the custom fields are set up correctly. A request to the following endpoint: https://www.zohoapis.com/inventory/v1/settings/preferences/customfields?organization_id=${ZOHO_ORGANIZATION_ID}&entity=shipment_order
                                                                                                            • Kaizen #202 - Answering Your Questions | Testing and Using REST APIs in Widgets

                                                                                                              Hello Developers! Welcome back to a fresh week of Kaizen! Thank you for your active participation in sharing feedback and queries for the 200th milestone. This week, we will look at the following queries related to widget: Widget Testing Using REST API
                                                                                                            • Next Page