Zoho Developer Hangout (ZDH) – Episode 26 | Smart Email & Phone Validation – Client Script & Deluge
25:46

Zoho Developer Hangout (ZDH) – Episode 26 | Smart Email & Phone Validation – Client Script & Deluge

Zoho 26.02.2026 711 просмотров 12 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
Zoho Developer Hangout (ZDH) is a space where our developer community members discuss all things tech and how to overcome real-time business challenges. In this session, Bhoomi Joshi, a Zoho Community MVP and Client Script category-winner at the ZDC Hackathon 2024, explores a shift-left approach to data validation: catching issues at the UI layer instead of cleaning them up later in workflows, reports, or downstream systems. Using Zoho Client Script with Deluge where needed, she walks us through practical patterns for real-time email and phone validation and duplicate detection. CHAPTERS: 00:11 – Agenda and use case 03:01 – Tech stack used 03:34 – Validating emails 11:58 – Validating phone numbers 16:38 – Validating in Detail page 19:33 – Handling duplicate records 25:20 – Recap For all those who missed the previous episodes, please visit the ZDH playlist link below: https://youtube.com/playlist?list=PLlC7sQNISSUTspKlOAhG5A6AhJSkAe87c For more such developer-centric events, visit: https://community.zoho.com/developer/events/ If you're not part of the Zoho Community, and would like to network with others and benefit from all that the community has to offer, visit our platform mentioned below. Sign in using your existing Zoho credentials or create a new account through the Sign Up form. https://www.zohocommunity.com/ Drop an email to zdc(at)zohocorp(dot)com for further information. 👇 SUBSCRIBE👇 ️ ♦️ YouTube - https://www.youtube.com/zoho ️ ♦️ LinkedIn - https://www.linkedin.com/company/zoho-community/ ️ ♦️ Twitter - https://x.com/ZohoCommunity ️ ♦️ Facebook - https://www.facebook.com/ZohoCommunity/

Оглавление (7 сегментов)

Agenda and use case

Hello everyone. I'll start with one question. You are working with many clients. Uh you might be using Zo CRM, Zo campaign. So I have a question for all of you. Have you ever come across the situation where you are have to deal with duplicate data or you are sending any campaigns to your lead or contact most of them are getting bounced. So anyone of you have come across such situation where you have to deal with duplicate records in your account or your emails are not reaching to client account when you are sending workflows or you are sending email campaigns. So here is something I'm going to present today is uh that a real use case that we are implementing with many of our client and today I'm going to share it with fellow developers. So it's a realtime email verification. So it is something uh that you all of you might have come across this situation and you might have tried some solutions like installing any plug-in or something. So it's like let's say I have a CRM account and a lead module right now if uh in any of your sales team member or any one of is entering any lead here. Let's say I'll add the test report first and I am entering any random email over here. This email might look correct to you when you are entering to the system but we don't know in real time whether this email is really exist on gmail. com if I'll send any workflow to this email will it really reach to their sandbox or if any campaigns uh being sent will any newsletter will reach out to this email. So in that case what exactly we are trying is we'll go to the solution like we'll install some plugins to our system in CRM but when you install any plug-in it will create lot of fields in your lead contact and that will always work after creation of record when you save the record the plug-in will start working on it will find out whether this email is deliverable or not and it will update the status here again you need to do some manual effort to remove those data do uh invalid email data. System will not automatically remove them. So here the real time email verification will come into picture. So what it do is using a client script and del combination first it will when we are entering the data it will try to validate the email and it notifies the user whether the email is deliverable or not. So at that time only while creating record only we'll be able to understand whether this email is deliverable or not. So let's see how it works. So here

Tech stack used

tech uh technology that I'm using is client script and deluge and I'm also using API called abstract API. So again when you go to any plug-in when you install the plug-in it will add double course to the client. You have to pay for plugins as well as for API. But if you go with the custom solution like adding a client script and del to verify the email, you don't need to install any plug-in. It will not create any field to your system and it will real time check with the deliverability.

Validating emails

So let's go and write one script. It's a very small function but it will really help you uh save the lot of data and it will not add any junk email to your system. First we'll try on create page leads module and you can add this event either on save event or as a field event. — [snorts] — So first thing is we'll try to get the email field. Then we'll get the value. Now next thing is uh del function. How the del function uh will make a call to the del function into client script. and script for delus function. I'll uh execute now one. We'll create a standalone function. So del function I'm using as a helper function. And what delouch function will do is uh from client script when we call this del function it will uh trigger an API call and uh it will uh check whether the email is deliverable or not and based on the status it will uh return whether email is valid or invalid and we can read this response into our client script and copy this code name. So now next thing is uh we can call this function on our client script. And we'll pass email as a parameter here. So email is my key value and from here this email is my email value actual value and from del function we'll read the response. If result is uh we wrote two different status right one is valid and one is invalid. So accordingly we can check here if result is invalid. We can throw an error message. One minute. We'll go to lead. We'll refresh our screen and we'll try to create one lead. Now I am hard refreshing my screen because as we all know client script is based on JavaScript and sometimes if cache is there your client script will not work properly. Okay, I'll first uh I'll enter one wrong email here. So uh like when you look at the email, you will feel that this email is correct because it syntax is correct, domain is correct, everything looks uh that email is good. But how do you know that actually if email is deliverable or not? So here when your client script will start working. It is on field change. So it will uh try to find whether this email is deliverable or not. If it is invalid, it will show error. And we can also do one more thing. Uh just hold sorry one moment. And I'm saving this API key over here. And then I'm uh calling the API key as we can see. Give me a moment. Sorry uh sorry I forgot to inform one thing. This function should be uh change to rest API and API key to then only we can call it to the client script otherwise this function will not work. Let's [clears throat] Yeah. So we can see this email is invalid email because when you uh in real case when you send email to this email it will bounce back to your inbox because this email doesn't exist on Gmail server. So uh how this script will be useful is it will save lot of data when you are sending workflow emails campaigns you can get rid of this uh non-deliverable events from the starting while creating the record itself while editing and while creating definitely we can do that. So this is mostly helpful to the sales team when they are going to the field then meet a client they'll add the details to the CRM and they'll enter the data. So while creating definitely no one will be able to understand that whether the email is correct or not because as we can see here when we are entering this email actually looks uh correct only. But when you are sending email to the client they might complain that we are not receiving any email to our inbox or newsletter. At that time this will be very helpful and currently why this solution is uh helpful is because if you depend on any plugins you have to pay extra cost it will create lot of fields in your system and even after installing plug-in you need to do manual effort to remove those junk emails junk leads. Another issue with only deluge code is that will only check the validity of an email after saving the record. deludes cannot detect the while creating it. Next thing is same way we are validating email. Uh we

Validating phone numbers

are also uh like using phone numbers to send messages, SMS or uh WhatsApp chat to our leads and contacts many time but uh we ever got this thought in mind that whether the mobile number or phone number we are entering is correct or not. Same way as email they might complain that it's not reaching to our system. So similarly same way we are validating email we can also validate phone using the same API and this one is also available for free you'll get 100 credits for free every month so this is one more API that we can try on the lead okay let's add a script Okay, same again uh with the same approach we'll create one uh del function and from del function only we'll make a call to API. Okay. So here also we are making a call to phone intelligence abstract API and uh each API will be having different API key. So again if you want we can store this API key into a variable and make uh use that variable to get the API key and then we'll check whether the phone number is valid or invalid and accordingly we are returning the message and again this function uh should be we'll add argument form This function should be changed as rest API function. So we can call it into client script and copy the code. Okay. So yeah if phone number is invalid uh the del function will uh inform us that number is not valid and accordingly we'll display the error and here we are passing phone as argument and save and let's try with number I'll first I'll enter uh any invalid number to check the error. We can see phone number is invalid. Now we'll try with some correct number then it will not display any error. So again same as email we can save a lot of leads and we can create a lead which is having correct numbers. So our SMS workflows or any WhatsApp workflows are there it will reach out to the user end user. So same as we wrote result equal invalid then trigger an error. In other case you can write success message with the same either with an alert or with this only phone number is valid.

Validating in Detail page

on the detail page. I'll frankly say that sometimes client scripts are not supported. So on the detail page, if you want to validate, I'll suggest to go with validation rule, custom validation rule. So I can demonstrate that as well. So now let's say uh we have uh requirement. I'll create one record. Uh we already have it I guess. Yeah, we already have one record. And uh on detail page if I want to check whether this email is deliverable or not. We can always go with the custom validation function. Go to the same API will work uh over there as well. So right now I have disabled it. I'll turn on and uh we can see the code here. Yeah, here we are doing nothing. It is same function as we have on client script. It will make a call to abstract API with email and it will display the error accordingly. Let's check now here when we'll try to validate We can choose a button. Sorry, this is inex. I'll try Gmail. Email entered is invalid. So, we can always go with validation uh custom validation deluge code on a detail page or the either way is we can block users from editing the email and phone on detail page using a client script. That's another way to do it. Go to settings, search for client script and here we go. And we can add new script for any module. Like here we can give a name as email verification contact. Choose the module. Create page or edit page. Module let's say contact. Then whether you want to go with page event on save on uh in this case it will be either on save or on field change field you can choose as email and event on change and then deluge code we can write a standalone function which is under developer hub create a new function and choose standalone here and after uh Let's say if you want to make a call this uh call this function into client script you always have to publish it as a rest API then only you can call it into your client script. My next part is uh duplicate uh email uh duplicate record detection. So again we know that

Handling duplicate records

CRM is having that feature when you are creating a lead if any contact is already uh there in the system it will notify you that contact with the same email already present but we never got the thought like uh let's say uh this lead is present in the system and contact is also having the same email but there might be a chances that uh mobile numbers can be a different or mobile numbers are same but person might have personal email and their company email. So in that case leads are same only the person email is different but CRM will only uh detect the duplicate records based on email. Now what do we do if we want to find out whether uh lead with the same number already exist in contact. So there we can again go with the client script. In client script we can find whether any contact is present in the system with the same mobile number with the same email or a combination of both. And again I'll say that when it is a duplicate record we might every one of us might have faced an issue where client will complain that there is lot of duplicate data. Now what do we do? How do we get rid of them? So all of these things requires again manual effort and it is a time consuming thing. So if you have any script from starting before creating record only if we can identify them then it will uh definitely reduce lot of human effort. So let's try one function. Now here this one is only possible to achieve through client script. You don't need to write any deluge code. We'll check for lead and contact. here. We'll do it on save because we want to check for both phone number and email duplication. So yeah, we can see here first I'm getting the email field, phone field, its value and this one is for checking whether email uh email is duplicate or phone number is duplicate. Then what we are doing is we are using a client script function search by email and search by phone. So when we are entering the email address, it will check whether any contact is already present with the same email. If yes, then it will change this variable to true. Then again same thing with phone. If same contact is already available with the same phone number, it will notify the user that contact with the same number is present in the system. And then accordingly we are showing alert here instead of error message. Restriction like on uh field change we cannot do. But if it is on save then yes it's possible through return false. If you return false then client script will not allow you to save the record. But if it is on field change then we cannot uh restrict someone to save. I'll save this code. Okay. So here this script will check uh based on email, phone and combination of both. So first we will create one uh we I already have one contact with the same email address. So first we'll check with email. Now when we will try to save it will uh so this is CRM's default feature which will identify whether contact is available with the same email or not. We have to hard refresh because we wrote a client script. Yeah. So we can see contact with the same email already exist. system will notify you. Now, next thing is we can check for phone number as well. Uh here we have one number. I'll copy the same number and I'll try to create with. So now system is uh defining contact with the same email and phone number already exist. So this is how we can prevent creation of a duplicate uh record where same number and emails are present. We can even check for only phone. Yeah, contact with the same phone already exist. So here we are checking a combination for identifying duplicate records uh with contact phone alone, email alone and combination of email and phone. The script that I wrote is currently uh like standard script. But here always you can uh write down like to based on the search condition you can include plus 91 or let's say if in contact + 91 is there — you can remove them uh country code and check with the number we can always do customization with this code but this is just an example that I'm using right now

Recap

this is what I was trying to share with my fellow developers like how we are struggling with our daily duplicate records and email verification. We are spending lot of uh like money to buy plugins. But what it does is again it requires manual effort. So you can always go with this kind of custom solution. So thank you all of you again.

Другие видео автора — Zoho

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник