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.
showConfirmationTo 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.
openMailerTo 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 });

successZDK.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!


    Access your files securely from anywhere

        Zoho FSM Video Tutorials


              All-in-one knowledge management and training platform for your employees and customers.






                                    Zoho Developer Community




                                                          • Desk Community Learning Series


                                                          • Digest


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Glossary


                                                          • Desk Marketplace


                                                          • MVP Corner


                                                          • Word of the Day


                                                          • Ask the Experts



                                                                    • Sticky Posts

                                                                    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

                                                                      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
                                                                    • Kaizen #256 - Build an Arrival Readiness Web Tab in Zoho CRM

                                                                      Hi everyone! Welcome back to the Kaizen series! In the post, we discuss a use case in hospitality industry: how an Arrival Readiness web tab widget can be used to let reception staff identify and resolve issues before arrival of guests. Use case In the
                                                                    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

                                                                      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
                                                                    • Kaizen #226: Using ZRC in Client Script

                                                                      Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
                                                                    • Kaizen #222 - Client Script Support for Notes Related List

                                                                      Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how


                                                                    Manage your brands on social media



                                                                          Zoho TeamInbox Resources



                                                                              Zoho CRM Plus Resources

                                                                                Zoho Books Resources


                                                                                  Zoho Billing 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

                                                                                                      Get Started. Write Away!

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

                                                                                                        Zoho CRM コンテンツ




                                                                                                          Nederlandse Hulpbronnen


                                                                                                              ご検討中の方






                                                                                                                        • Recent Topics

                                                                                                                        • WhatsApp Coexistence

                                                                                                                          Hello, please implement WhatsApp Coexistence, we need to track staff whatsapp chats on their PC and they need to be able to use WhatsApp on their mobile in around the office and warehouse, as we video call customers and send them product pictures. Thank
                                                                                                                        • WORK DRIVE CUSTOMIZATION

                                                                                                                          WORK DRIVE CUSTOMIZATION Create folder for every Case by “Contact Name “in Work Drive under Associate Deals Folder Directory: User Work Drive Accounts: Route Directory Associate Cases Case Name, Case Number Client Upload- Shared with contact (for collaboration)
                                                                                                                        • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

                                                                                                                          Availability Update: 29 September 2025: It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition exclusively for IN DC users. 2 March 2026: Available to users in all DCs except US and EU DC. 24
                                                                                                                        • Vendor payment unexpectedly routed through Prepaid Expenses instead of Accounts Payable

                                                                                                                          Hello, We are investigating an unexpected accounting behavior in Zoho Books. We created vendor bills and vendor payments for two suppliers using what appears to be the same workflow, but the journal entries are different. Vendor 1 – UZ Store (works correctly)
                                                                                                                        • CRM wants to access other apps and services on this device (Documents area)

                                                                                                                          Did anyone else see this today? It only seemed to popup in the Documents area. Blocking it did not stop the ability to upload files there... Why is this coming up and what apps/services is it requesting in the background? Also, is it applicable elsewhere
                                                                                                                        • BANK CHARGES

                                                                                                                          When paying a supplier via credit card we are charged a fee. I process the payment through payments made and then enter the fees in bank charge. However i get this message :  Bank charges are applied. Please select a bank account. And it will not let
                                                                                                                        • Programmatic Itemized Expenses?

                                                                                                                          It does not appear that it is possible to create itemized expenses programmatically (via the API)? Is this correct, or am I misunderstanding the situation?
                                                                                                                        • Go Multilingual with Instant Bot Auto-Translation

                                                                                                                          Imagine you run a travel company with customers across different regions. Your website chatbot helps visitors discover travel packages, answers questions, and makes bookings. As your business expands into new markets, you want to offer the same experience
                                                                                                                        • JOIN with Select and TOP not returning data to results

                                                                                                                          hi when I add TOP to yellow it does not return cl."Id", cl."Date",cl."Outcome", cl."Membership" from the join. Remove it and they appear. The TOP and the ON seem to work as in the number of rows returned. Doing the classic join log table and return only
                                                                                                                        • Zoho CRM Multi-select values not translated

                                                                                                                          Hello! I have some issue with translate custom multi-select fields in zoho CRM in other language. I download export file, but it has all my custom fields and picklist values exept multi-select fields picklist values.  Please, help me to undestand, is
                                                                                                                        • [Free webinar] Blueprint as a business process engine - Creator Tech Connect

                                                                                                                          Hello everyone, We are excited to invite you to another edition of the Creator Tech Connect webinar. About Creator Tech Connect The Creator Tech Connect series is a free monthly webinar comprised of pure technical sessions, where we dive deep into the
                                                                                                                        • Automating CRM backup storage?

                                                                                                                          Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
                                                                                                                        • Allow Email Attachments to Be Opened Directly in Zoho CRM

                                                                                                                          Hi all, It would be very helpful if attachments linked to an email in Zoho CRM could be clicked and opened directly from the email preview. Currently, the attachment names are displayed, but the experience of viewing them is unnecessarily limited. Users
                                                                                                                        • Dashboard Metric Drill-Down Shows Stale Data

                                                                                                                          Summary: When clicking between different metric components on a custom dashboard, the drill-down list shows data from the previously opened metric instead of the one just clicked. Steps to Reproduce: Create a custom dashboard with multiple pre-defined/templatized
                                                                                                                        • Zoho email suddenly stopped working - any ideas to fix this ?

                                                                                                                          Zoho email suddenly stopped working. although got this sent to me Reporting-MTA: dns; mx.zohomail.eu Arrival-Date: Wed, 26 Aug 2026 12:48:05 +0100 Original-Recipient: rfc822; Final-Recipient: rfc822; Status: 421 Action: delayed Last-Attempt-Date: 26 Aug
                                                                                                                        • GCLID and Zoho Bookings

                                                                                                                          Is there anyway to embed a Zoho Bookings signup on a landing page and pass the GCLID information? More specifically, can this be done using auto-tagging and not manual tagging the GCLID? I know Zappier has an integration to do this but is there a better
                                                                                                                        • Calendar Booking - Rescheduled and cancelled appointments not deleting in G Suite calendar

                                                                                                                          We started using the built in calendar booking feature and are really liking it! However, we are having one issue.  If a client reschedules an appointment using the reschedule feature the original appointment doesn't get deleted out of our g suite calendar
                                                                                                                        • Automate pushing Zoho CRM backups into Zoho WorkDrive

                                                                                                                          Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
                                                                                                                        • Backup to external location (Dropbox etc)

                                                                                                                          Dear Zoho Team, I've set the CRM Backup schedule to once a month, which when complete sends me an email. Of course I then need to manually login and download the file. Nice but VERY 20th century and relies on us humans not to fail. Can you please provide
                                                                                                                        • Cloud backup for CRM

                                                                                                                          This is an idea / feature request for ability to periodically export CRM backup to an external cloud provider, similar to Zoho Vault: https://www.zoho.com/vault/data-backup.html Alternatively I would help being able to access manual data backup programatically
                                                                                                                        • Introducing throw statements in Deluge

                                                                                                                          Hello everyone, We're introducing a powerful addition to Deluge that gives you more precise control over error handling in your scripts. Whether you're calling an external API, validating user input, or enforcing a business rule, there are moments when
                                                                                                                        • Introducing throw statements in Deluge

                                                                                                                          Hello everyone, We're introducing a powerful addition to Deluge that gives you more precise control over error handling in your scripts. Whether you're calling an external API, validating user input, or enforcing a business rule, there are moments when
                                                                                                                        • Zoho Creator to Zoho Writer for prefilled documents...

                                                                                                                          In response to the question about connecting Zoho Creator to Zoho Writer for prefilled documents, I wanted to share a working implementation that demonstrates how to use the record_id parameter with the Zoho Writer Merge API. This allows Writer to automatically
                                                                                                                        • Upload a video to embed into an article

                                                                                                                          How can we upload a video to embed into the article...? We can upload images but this only seems to support image files. And the video option seems to just support YouTube, Vimeo and DailyMotion which is no good, we need to create our own videos and upload
                                                                                                                        • PAN - Aadhar Link Status

                                                                                                                          Can Zohobooks also get latest PAN-Aadhar Linking Status from Income Tax Portal ?
                                                                                                                        • LinkedIn RSC is now live in Zoho Recruit

                                                                                                                          LinkedIn Recruiter System Connect (RSC) is here. Your Zoho Recruit data (candidates, jobs, notes, stage updates, resume attachments, and more) now syncs with LinkedIn in real time. Note: LinkedIn RSC is included with your LinkedIn Recruiter Corporate
                                                                                                                        • Zoho Writer for Android - Headings

                                                                                                                          Hello Zoho team, I have created structured doc with headings in writer web version on pc. Then I have opened it in my phone. Write is crashing while used function: menu "three dots", Document Navigation, Headings. Zoho Writer for Android 6.1.4 Samsung
                                                                                                                        • The in between line spacing management

                                                                                                                          In the Microsoft Word, when we write something there is a tool from where we can manage the line spacing. Here in writer app in mobile it is by default 1.5. I request Zoho Team to give the option from where I can control Line Spacing, Remove space between
                                                                                                                        • Zoho Books | Product updates | September 2026

                                                                                                                          Hello Partners, We've rolled out new updates to Zoho Books. From a brand-new Nigeria edition expanding our presence on the African continent to the new Super Admin privilege, here's everything that's new this month. Nigeria Edition Now Live [Nigeria Edition]
                                                                                                                        • Cross-application Deluge calls fail when application link name starts with a number

                                                                                                                          I encountered an issue when calling a custom function in another Zoho Creator application within the same account. The target application’s URL/application link name began with a number, similar to: 27_example_application The following cross-application
                                                                                                                        • Pulling data from lookup fields

                                                                                                                          If I try to pull in CRM data from a lookup field, it only shows a number and not the actual name. Is there a way to get around this? It impossible to do reports using lookup field data.
                                                                                                                        • CRM x WorkDrive: We're rolling out the WorkDrive-powered file storage experience for existing users

                                                                                                                          Release plan: Gradual rollout to customers without file storage add-ons, in this order: 1. Standalone CRM 2. CRM Plus and Zoho One DCs: All | Editions: All Available now for: - Standalone CRM accounts in Free and Standard editions without file storage
                                                                                                                        • Marketing Tip #49: Set up Meta Pixel and turn store visitors into repeat buyers

                                                                                                                          Most of your store visitors don't buy on their first visit. They browse, get distracted, and leave. Without a way to reach them again, that traffic is gone forever. Meta Pixel changes that. What is Meta Pixel? Meta Pixel (previously called Facebook Pixel)
                                                                                                                        • unable to join meeting due to speaker issue

                                                                                                                          unable to join meeting due to speaker issue
                                                                                                                        • Unlock smarter scheduling with AI in Zoho Bookings

                                                                                                                          Hello everyone! Scheduling touches more parts of a business than we often realize. Teams need to coordinate. Workflows need to move. Business apps need to connect. And with AI, the way we interact with scheduling is changing too. Join our upcoming live
                                                                                                                        • Zoho CRM Layout Rules: Nine New Actions, Profile-Based Execution, and Interactive Preview

                                                                                                                          Hello everyone, Availability: This feature is now available for all users. We’re excited to announce powerful new enhancements to Layout Rules in Zoho CRM - a feature built to guide our teams through form-filling by showing the right information to the
                                                                                                                        • I want to delete payment detail of my cards from the system.

                                                                                                                          I want to delete payment detail of my cards from the system.
                                                                                                                        • Urgent: Outgoing Emails Delayed Across All Zoho Desk Departments

                                                                                                                          Dear Zoho Support, We have started receiving delivery delay notifications across all our Zoho Desk departments. Error details: Error: 451 4.7.500 Server busy Action: Delayed Receiving system: Microsoft 365 / Exchange Online Affected Zoho sending IPs identified
                                                                                                                        • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

                                                                                                                          Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
                                                                                                                        • Les meilleures pratiques d’email marketing pour booster les ouvertures, les clics et les conversions

                                                                                                                          L’email marketing connaît aujourd’hui des changements profonds. Gmail, Yahoo et Microsoft ont notamment renforcé leurs exigences en matière d’authentification, ce qui rend la délivrabilité plus complexe et exigeante. Dans le même temps, les filtres basés
                                                                                                                        • Next Page