Kaizen #59 - Creating alerts and custom messages using Client Script

Kaizen #59 - Creating alerts and custom messages using Client Script

Hello everyone! 
We are happy to resume our Zoho CRM Developer Community series - The Kaizen series!
Welcome back to the new start of Kaizen!
This post is about Client Script and its simple use cases involving ZDK Client functions.

What is Client Script?

The Client Script feature gives you a seamless platform for achieving and extending your business cases in Zoho CRM by allowing Java Script code execution in your browser. It enables you to configure events for the UI components and define the actions once those events are triggered. 

The ZDK Client Functions available in Client Script are,

ZDK Client Function
Description
showMessage 
To display a text message on create/clone/edit/detail(canvas) page.
showConfirmation
To display a confirmation box with accept and reject message on  create/clone/edit/detail(canvas) page.  
showAlert 
To show alert message on create/clone/edit/detail(canvas) page.
openMailer
To open mailer component from detail(canvas) page.

Use Case

Let us consider that you want to achieve the following using Client Script.
  1. Calculate age based on Date of Birth and display the message "Age is more than 80" whenever the age is above 80 in create page of Policyholder module.
  2. Show the alert message "You cannot change the Rating of a verified account" whenever you try to update the field Rating in Accounts module.
  3.  When you click the mail button on detail(canvas) page, ask for confirmation and open a mailer window.

Solution using Client Script

Note:

The solution listed in this post includes detail(canvas) page and create page.
To create a canvas page, 
  • Go to Setup > Customization > Canvas
  • Click Create Record Detail Page. 
  • On the Create a Custom Record pop up that appears, select the module as "Accounts" and select the required layout for the canvas page
  • Choose a template from the gallery and click Select.
  • Enter a name and save the canvas page.
  • Click Canvas Assignment and assign the page to the required profiles.
  •  Click here for more details on creating a canvas page(Customizing the record detail page).
1. Calculate age based on Date of Birth and display the message "Age is more than 80" whenever the age is above 80 in create page of Policyholder module

  • Go to Setup > Developer Space > Client Script. Click +New Script.
  • Specify the details to create a script and click Next.

  • Enter the following script in the Client Script IDE and click save.
  1. function  getAge(dateString) 
  2. {
  3. var today = new Date();
  4.  var birthDate = new Date(dateString);
  5. var age = today.getFullYear() - birthDate.getFullYear();
  6.  var m = today.getMonth() - birthDate.getMonth();
  7.  if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) 
  8. {
  9.    age--;
  10. }
  11.  return age;
  12. }
  13. let age = getAge(value);
  14. var age_field = ZDK.Page.getField("Age");
  15. var category_field = await ZDK.Page.getField("Category");
  16. age_field.setValue(age);
  17. if (age > 80) {
  18. ZDK.Client.showMessage('Age is more than 80', { type: 'info' });
  19. }
  • You can see the code working from the create page.  You can also see how the client script works using the Run component of the Client Script IDE.

  • You can use any of the following types in showMessage() function
Possible 'type'
Script
info
ZDK.Client.showMessage('message', { type: 'info' });


warning
ZDK.Client.showMessage('message', { type: warning });

error
ZDK.Client.showMessage('message', { type: error });

success
ZDK.Client.showMessage('message', { type: success });

2. Show the alert message whenever you try to update the field Rating

  • Go to Setup > Developer Space > Client Script. Click +New Script.
  • Specify the details to create a script and click Next.

  1. ZDK.Client.showAlert('You cannot change the Rating after account creation');
  • Here is how the Client Script works. You can also see how the client script works using the Run component of the Client Script IDE.

3. Configure the mailer box with the click of a button

First of all, you need to add the button to the detail(canvas) page.
  • Go to Setup > Customization > Canvas.
  • Right click on the Canvas page for Accounts module and click Edit.
  • Click Elements, drag and drop the button wherever required and specify a label for the button.
  • Right click on the button, select Add Element ID and enter the ID of the button in the pop up that appears.
  • Once the button is created, you can configure Client Script in two ways:
  • Right click on the button--> Add Client Script-->onClick. The Client Script IDE appears with the event type as Canvas Button Event.
                                                             (or)
  • Go to Setup > Developer Space > Client Script. Click +New Script.
  • Specify the details to create a script and click Next.

  • Enter the following script and click save.
  1. var isProceed = ZDK.Client.showConfirmation('Do you want to open the mailer window?','Proceed','Cancel');
  2. //If user clicks Proceed button
  3. if (isProceed) {
  4. ZDK.Client.openMailer({ from: '', to: [{ email: '', label: 'ABC Industries' }], cc: [{ email: '', label: 'ABC Industries' }], subject: 'Greetings from ABC Industries!', body: ' ' });
  5. }
  • The showConfirmation() function will return a boolean value based on the user selection. You should capture this boolean value using a variable and write the actions based on the boolean value returned. Here the variable isProceed will capture the user response and based on that boolean value, the mailer box will get displayed.
  • Here is how the client Script works,

We hope you found this post useful. We will meet you next week with another interesting topic!
If you have any questions let us know in the comment section.
Cheers!

Click here for more details on Client Script in Zoho CRM.

Related Links


    • Sticky Posts

    • Q3 USA ZUG Meetups - Build AI Agents with Zoho

      Hi everyone! What if you could build your own AI agent from scratch in just one session? That's exactly what we're going to do at the upcoming ZUG Meetups across the United States, where you'll get hands-on experience with Zia Agents and explore how AI
    • Zoho CRM Community Digest - May 2026 | Part 1

      Hello Everyone! This edition introduces the new centralized Zoho Announcements Hub, a single dashboard designed to let you track and filter live product roll-outs from across the Zoho ecosystem. Alongside the Announcements Hub, this month also features
    • Zoho CRM Community Digest - April 2026 | Part 2

      Hello Everyone! We're back with Part 2 of the April Zoho CRM Community Digest to wrap up our monthly roundup. This week, the spotlight is on smart database connections, proactive error tracking, and optimizing subform line items without breaking your
    • Zoho CRM Community Digest - April 2026 | Part 1

      Hello Everyone! April brought a lot to unpack! From a long-awaited field renaming update to MCP (Model Context Protocol) support that lets AI tools talk directly to your CRM, the first half of the month was packed with updates. The community had some
    • Zoho CRM Community Digest - March 2026 | Part 1

      Hello Everyone! March kicked off with a strong mix of AI-driven enhancements, smarter data handling, and practical workflow improvements across Zoho CRM. From leveraging Zia for automated communication to optimizing cross-platform data retrieval, this
    • Recent Topics

    • Item/service subtotal

      Just discovered & really pleased that we can drag to re-order the line items in Sales orders & Invoices, a very nice feature which doesn't seem to be documented? It would be nice to be able to insert a subtotal as a line item to complete this great feature
    • The reason I switched away from Zoho Notebook

      My main reason for switching to Zoho was driven by three core principles: moving away from US-based products, keeping my data within India as much as possible, and supporting Indian companies. With that intent, I’ve been actively de-Googling my digital
    • I want to prefill CRM Account information using the GSTIN of the Customer

      Currently i need to add account details manually in zoho crm and when it syncs in zoho books manual working needs to be done. Whereas in zoho books i can prefill the customer details using the GSTIN which is great feature. Can the same be enabled for
    • #5 Is This Actually The Right Tool For Me?

      Day 5: Before Meera brought six months of business history into Zoho Invoice, she stopped and asked herself a very sensible question: Is this actually the right tool for me? It is much easier to ask that now than after moving all your data. The Usual
    • Timesheet entry and comment on the actual timesheet

      Dear madam/sir, It would be really helpful if we could add an option to comment on a specific timesheet entry, after the employee logs a time-log. Would that be possible in the future? Or can you suggest another way to do this?
    • OpenAI Is Moving to the Responses API: Here's What It Means for SalesIQ

      OpenAI has deprecated its Assistants API and is moving to the Responses API. If you're using OpenAI Assistants with SalesIQ, you may be wondering if you need to make any changes to your existing setup. You don't. SalesIQ has already taken care of the
    • Need Native Support for docx files in Zoho Writer

      Absolutely love Zoho Writer, but often need to share files by email with people who are in the Office ecosystem. Downloading a file as docx, then sending it by email, getting the comments back, converting it to Zoho format, editing it, then converting
    • CRM integration issues

      hi Just start testing Campaigns. Read up on up on these issues but can not find an answer. I am super admin. 1) its only showing 1002 contacts, I have a 2500 plan which is confirmed in dashboard. I says it sync'd 1400. I've looked at missing contacts,
    • What's New in Zoho Expense: Integrated Business Travel and AI-Powered Expense Management

      This release brings a wide range of updates across Zoho Expense, including new AI-powered capabilities, enhancements to corporate cards, expense management, audits, and more. Keep reading to know how the new updates can transform your travel and expense
    • ChatGPT Plugin / MCP Server auth error

      Hi all I'm trying to connect the ChatGPT plugin for Zoho CRM but after username stage of the auth process, I get this error from the URL https://mcp.zoho.eu/mcp-client/ {"error_description":"Invalid request url, Request is not as per defined in oauth
    • Project Management Platforms for AI Agents: What Matters Most?

      Zoho Projects is already going beyond basic AI assistance with MCP, AI Bridge, and integrations that let AI models access project data and perform actions. That raises an interesting question: what should a project management platform for AI agents actually
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Sync workdrive feature inside ZohoCRM

      Hi, I'm exploring the new workdrive/ZohoCRM connector released by Zoho to replace the free extension workdriveforCRM which is decomissioned https://marketplace.zoho.com/app/crm/zoho-workdrive-for-zoho-crm I'm rather upset with this long awaited feature,
    • Adding Custom Status Options in Work Order Action Menu

      Hello FSM Team, We would like to inquire if it is possible to add more custom options in the Work Order action/status dropdown (e.g., Cancel, Terminate, Non-Billable, Void, etc.). Currently, the available options are limited, and we are unable to customize
    • Timesheet Task Icons

      In the image below which shows the task field drop down when creating a timesheet against a project and task. What do the icons mean the the right side column against each task? I can't find any documentation or guide that explains what the no entry sign,
    • Open Records in a New Browser Tab

      Hi FSM Team, Just a suggestion: It would be helpful to have a right-click → Open in New Tab option in FSM, similar to CRM. This should ideally work for any clickable record or module, allowing users to open multiple records in separate tabs without losing
    • Facturation électronique 2026 - obligation dès le 1er septembre 2026

      Bonjour, Je me permets de réagir à divers posts publiés ici et là concernant le projet de E-Invoicing, dans le cadre de la facturation électronique prévue très prochainement. Dans le cadre du passage à la facturation électronique pour les entreprises,
    • Marketing Tip #18: Make your online store mobile-friendly to improve traffic

      Most online shoppers browse on their phones first. If your store is hard to read, slow to load, or tricky to navigate on mobile, they’ll bounce fast. A mobile-friendly store doesn’t just look nice; it improves engagement, reduces drop-offs, and helps
    • Cannot add note to record on mobile

      In the latest version of the mobile app - if a record already has notes associated with it - you can add a note via the mobile app - if a record does not have previous notes there is no way to add a new one - it allows me only to send email
    • Admin Logging in as another User

      How can a Super Admin login as another user. For example, I have a sales rep that is having issues with their Accounts and I want to view their Zoho Account with out having to do a GTM and sharing screens. Latest Update (27th April 2026): With the early
    • Dashboards for Customers

      Is it possible to build dashboards for each customers in the community for their tickets?
    • Custom color coding for your entities

      Our brains are fine tuned to recognize colors before any text or shapes, making color coding a powerful tool to organize data and find items quickly. Color coding of our day-to-day work help with quickly processing the information, reducing cognitive
    • The Social Wall: August 2026

      Hello everyone. Welcome to the August 2026 edition of The Social Wall. This month, we're bringing you updates that make it easier to reach your audience, manage more channels, and streamline your publishing workflow. Here’s what’s new. WhatsApp bulk messaging
    • Check out in Meetings

      Why there is no check out in Meetings of Zoho CRM, very difficult to track
    • How do I get to "Admin Panel"

      I just started a Cliq account. I am the sole administrator. As I read the documentation, I keep seeing reference to an "Admin Panel". I see no way to access this from my Cliq account. How do I access this panel?
    • 【初開催! オンライン】Zoho Campaigns メール配信の基礎・活用勉強会を開催します! 10/15 参加無料

      ユーザーの皆さま、こんにちは。 Zoho コミュニティグループの中野です。 Zoho ユーザーコミュニティ初となる、メールマーケティングをテーマにしたオンライン勉強会を開催します! ▶︎イベント詳細・参加登録はこちら 今回取り上げるサービスは「Zoho Campaigns」です。 「Zoho CRMとZoho Campaignsのどちらからメールを配信すればよいか分からない」 「一斉配信はできるようになったけれど、現在のリスト管理や設定が正しいか不安」 「メールを送るだけで終わり、配信後の改善につなげられていない」
    • Lookups and Custom Modules

      I created a Custom Module that I'm calling "Item Purchasing Group". This module will store information for groups of Items that must be purchased together (including minimum overall quantities and/or values, etc.). This will have a one-to-many relationship
    • Marketing Tip #46: Run flash sales the right way

      A flash sale can do a lot for your store. It can clear slow-moving inventory, spike revenue on a slow day, or reward your most loyal customers. But if done carelessly, flash sales can backfire. Customers start expecting discounts, stop buying at full
    • Introducing Smart Fields in Zoho Forms

      Hello form builders! We are excited to introduce Smart Fields in Zoho Forms - a faster way to add calculations to your forms without writing formulas. Instead of creating multiple fields and configuring complex calculations yourself, you can now drag
    • Checkbox not displaying correctly in subform

      Greetings: I have shared my app (wv) with support.  I am having problems with a checkbox field not displaying correctly in a subform.  The main form is called volunteers and the subform is called volunteers_subform.  The field in question is called roles. When you access the subform by itself the checkbox lookup displays as checkboxes.  But when you view it in the main volunteers form, it displays as a multi-select dropdown instead.   I have attached jpegs showing the difference.   Any thoughts?
    • Unbundle feature for composite items

      We receive composite items from our vendors and sell them either individually or create other composite items out of them. So, there is a lot of bundling and unbundling involved with our composite items. Previously, this feature was supported in form
    • Valid characters for use in email addresses using Zoho's apps/APIs

      We have found an issue with the + sign character in zoho subs - we are allowed to create a customer with an email address that has a plus sign but the API doesn't allow the + so the billing portal is not created. We are going to prevent users from using
    • Expand Zoho Analytics Spatial Capabitlities

      Dear Analytics team Thanks for the great product - I'm a big fan on Analytics and the monthly release highlights is one of my favourite emails to receive. I'd like to request expansion and improvement of Zoho Analytics spatial data capabilities, namely:
    • Automate customer follow-ups with Sequences in Bigin

      Greetings, We hope you're all doing well! We're happy to announce a new feature that we've added to Bigin. Following up with every lead at the right time can be challenging, especially when your team is managing multiple conversations across emails, calls,
    • Displaying only unread tickets in ticket view

      Hello, I was wondering if someone might be able to help me with this one. We use filters to display our ticket list, typically using a saved filter which displays the tickets which are overdue or due today. What I'd really like is another filter that
    • Can we have an automated TDS Receivable Recon with Form 26AS of Income Tax Portal ?

      Can we have an automated TDS Receivable Recon with Form 26AS of Income Tax Portal ?
    • Customers would like to add tips when paying in Client Portal

      I am happy with the clean interface of the Client Portal. However, I am running into a challenge: my customers would like to be able to add tips/gratuities when making payments. Currently, this is very clunky because they have to 1) manually over-pay,
    • Tag Limi?

      is there any way to create more than 20 tags? 
    • prefill_data for Creator + Merge & Sign

      Hello, Is there an option to use prefill_data for signer fields from creator? I see the option for CRM but it will not work with creator? I have tried passing the value in the signer data, and that also does not work. Alternatively, is there a way to
    • Delug script

      I have been looking at auto-update a amount (home currency) field from another module. Zoho native multicurrency was used in the other module (we have 4 here). Custom script was input with no error, but the field was not updated on trigger. Script as
    • Next Page