Using Client Script for Custom Validation in Blueprint

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. 
Hello everyone!

Welcome back to another exciting Kaizen post. Today, we will explore how to use Client Script to handle a use case in Blueprint beyond Zoho CRM’s native features. This will solve the use case raised in this community post.

Quote
"At Zylker, the Admin wants to proceed with a Blueprint transition only if at least one of the four fields is filled during the transition "Gather Details" . However, Blueprints only allow fields to be marked as either mandatory or optional. There's no built-in way to enforce a rule like at least one required.The use case is to add a custom validation that allows the transition only if any one of these fields in the mandatory fields form is filled."

In this post,


  • Need for custom validations in Blueprint
  • Client Script Events related to Blueprint
  • Use Case
  • Solution
  • When to use this event?
  • Summary
  • Related Links



1. Need for custom validations in Blueprint

In Zoho CRM, Blueprint allows administrators to streamline and guide users through structured processes by defining states, transitions, and mandatory fields at each step. While Blueprints support marking fields as mandatory or optional during transitions, they do not support conditional logic like at least one of these fields must be filled, making a field mandatory based on another field’s value, validating date ranges, etc.

To accomplish such requirements, you can use Client Script.

2. Client Script Events related to Blueprint

The following Client Script events can be used in Blueprint.

  • beforeTransition - This event occurs before the transition states of a Blueprint, as per the process flow designed in the blueprint. Click here to know how to use this event.
  • onBeforeMandatoryFormSave - This event occurs when the user clicks the save button of the mandatory fields form, but before saving the values.
  • You can use this event to validate the data entered by the user and stop proceeding further.
  • onMandatoryFormLoad - This event occurs when the mandatory fields form appears on the screen. If you want to show a message or accomplish any custom action when the mandatory fields form loads, you can use this event.

Click here to see the related Events documentation. These events can be configured in both Standard and Canvas Detail Pages.


Notes
Note:

In Zoho CRM, you can make certain fields mandatory for a particular transition in a Blueprint. When a user tries to save a record without filling in these required fields, Zoho CRM stops the action and shows a popup asking the user to complete the missing details.This popup is called the mandatory field form. This form also appears when you make fields mandatory using Layout rules.

3. Use Case

Zylker is a manufacturing organization which uses Zoho CRM. The Admin wants to ensure that at least one of the following fields is checked by the user before proceeding from the "Gather Details" transition.
  • GST ID
  • Payment Terms
  • Trade License Copy
  • Expected Monthly Order Volume
The following is the Blueprint configuration is for the transition "Gather details".



Blueprints only support marking fields as mandatory or optional, and there's no native way to enforce “at least one required.” However, the admin wants to add a custom validation to allow transition only if any one of these fields is filled. 

Solution

  • To accomplish this requirement, you need to create a Client Script with onBeforeMandatoryFormSave Event.

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


  • Enter the following script and click Save.
  1. if (form.Lead_Status == "-None-") {
  2.   if (
  3.     form.GST_ID_collected ||
  4.     form.Payment_terms_shared ||
  5.     form.Trade_License_Copy_collected ||
  6.     form.Expected_Monthly_Order_Volume
  7.   ) { ZDK.Client.showMessage("Transition Successful"); }

  8.   else {
  9.     ZDK.Client.showAlert("You must check at least *one* field to proceed");
  10.     ZDK.Client.navigateTo('record_detail', {
  11.       module: 'Leads',
  12.       record_id: $Page.record_id,
  13.     }); }}

  • In the above script, form is the argument of the onBeforeMandatoryFormSave Event. It holds the values of the fields in the mandatory form and the current value of the base field. Here the base field is Lead Status.

  • By checking the value of Lead_Status, the script ensures it only runs during the "Gather details" transition and does not trigger for other transitions.

  • The ZDK.Client.navigateTo() function redirects the user to the Detail Page and halts the transition process.

  • $Page.record_id is the Client Script constant that returns the current record id.

  • To inform the user, ZDK.Client.showAlert( ) displays the message "You must check at least one field to proceed", clarifying why the transition did not occur."

  • Here is how the Client Script works.


  • In this GIF, you can see that the transition is halted if none of the fields in the mandatory form are selected. However, if at least one field is checked, the transition proceeds as expected.

5. Summary

In this post, we have discussed 

  • When to use mandatory form events?
  • How to stop a blueprint transition based on custom logic?
  • How to navigate to a page using Client Script?
  • How to fetch the current record ID using Client Script?







      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Sticky Posts

          • Kaizen #197: Frequently Asked Questions on GraphQL APIs

            🎊 Nearing 200th Kaizen Post – We want to hear from you! 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 #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.
          • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

            Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
          • Kaizen #193: Creating different fields in Zoho CRM through API

            🎊 Nearing 200th Kaizen Post – We want to hear from you! 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.
          • Client Script | Update - Introducing Commands in Client Script!

            Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

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

                              Zoho CRM コンテンツ








                                ご検討中の方

                                  • Recent Topics

                                  • Zoho - Gocardless sales receipts

                                    I've been using gocardless for years and have d/d mandates set up on there. Each week we get bulk payments from customer d/d's. However, we need to send sales receipts to these customers. So I know I can sync mandates into Zoho, and then I can set up
                                  • Introducing Rollup summary in Zoho CRM

                                    ------------------------------------------Moderated on 5th July'23---------------------------------------------- Rollup summary is now available for all organizations in all the DCs. Hello All, We hope you're well! We're here with an exciting update that
                                  • Introducing Connected Workflows in Zoho CRM for Everyone : Free Your Teams to Focus on What Matters

                                    Hello Everyone, We’re thrilled to introduce the next big evolution in Zoho CRM for Everyone -- Connected Workflows. This new feature builds on our commitment to deliver a CRM that’s truly inclusive, adaptable, and designed for consistent collaboration
                                  • Introducing Connected Records to bring business context to every aspect of your work in Zoho CRM for Everyone

                                    Hello Everyone, We are excited to unveil phase one of a powerful enhancement to CRM for Everyone - Connected Records, available only in CRM's Nextgen UI. With CRM for Everyone, businesses can onboard all customer-facing teams onto the CRM platform to
                                  • Cooling-off Period Just Got Better: More Coverage, More Control

                                    We’ve enhanced the Cooling-off Period feature in Zoho Recruit to give you more control over repeat applications and referrals. This helps you maintain a cleaner, more efficient recruitment pipeline. With this enhancement, you can: Prevent duplicate candidate
                                  • 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
                                  • Revenue Management: #7 Revenue Recongition in Construction & Real Estate Industry

                                    If you are in the construction or real estate business, you are used to long project timelines and progressive invoicing to keep up with your billing. But when does revenue get recognized? Will it happen when the contract gets signed? At different milestones
                                  • TikTok (and other social platform) Messages and comments of the past

                                    When I link a social channel, Zoho will show in "Inbox", "Messages" and "Contact" sections the interaction done in the past? (comment, messages...)
                                  • Email Integration - Zoho CRM - OAuth and IMAP

                                    Hello, We are attempting to integrate our Microsoft 365 email with Zoho CRM. We are using the documentation at Email Configuration for IMAP and POP3 (zoho.com) We use Microsoft 365 and per their recommendations (and requirements) for secure email we have
                                  • How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.

                                    How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.
                                  • Restrict Employee mail deletion

                                    Dear Zoho, Is there a way where i can restrict my employees to delete any mails from their account
                                  • 554 5.1.8 Email Outgoing Blocked.

                                    Hi guys, I just singed up for mateusz.nowicki@zoho.com mail and I can't send any mails.. Why? Everytime I try to send something I got error like the one in the screenshot. Please, help me.
                                  • Zoho IP blocked by SpamHaus

                                    ERROR CODE :550 - 5.7.0 Your server IP address is in the SpamHaus SBL-XBL database, bye
                                  • File Upload in Creator's Subfrom

                                    Hello Sir/Madam, Here is a Problem......... Scenario: In CRM One Custom Module (Payments) have one File Upload Field now we have to Upload that File into Creator's Custom Form (Documents) have one Subform (Documents) in Document Upload Field using Deluge
                                  • integarting attachments from crm to creator

                                    when i tried to integrate pdf attachments from crm to creator via deluge i am getting this error {"code":2945,"description":"UPLOAD_RULE_NOT_CONFIGURED"} the code i used is attachments = zoho.crm.getRelatedRecords("Attachments","Sales_Orders",203489100020279XXX8);
                                  • Error AS101 when adding new email alias

                                    Hi, I am trying to add apple@(mydomain).com The error AS101 is shown while I try to add the alias.
                                  • Trigger workflow base on email clic

                                    Searching the help and forum, I see that there were workflow trigger rules based on email. But now, I can't find this type of trigger when I create a custom workflow. What I'm looking for would be to automate the sending of an email for a new prospect,
                                  • Bigin Form Acknowledgement

                                    How to troubleshoot and find out why form acknowledgement is not sending emails after form submission?
                                  • Option to Customize Career Site URL Without “/jobs/Careers”

                                    Dear Zoho Recruit Team, I hope you are doing well. We would like to request an enhancement to the Career Site URL structure in Zoho Recruit. In the old version of the career site, our URL was simply: 👉 https://jobs.domain.com However, after moving to
                                  • Zoho Mail POP & IMAP Server Details

                                    Hello all! We have been receiving a number of requests regarding the errors while configuring or using Zoho Mail account in POP/ IMAP clients. The server details vary based on your account type and the Datacenter in which your account is setup. Ensure
                                  • Ever since the new Android App udpates notifications are not working

                                    notifications are not working for the app is its closed I followed the tutuorial to the notificaction fixed and everythig seems to be right but notifications are not workig
                                  • Zoho Analytics & Zoho Desk - but not all desks

                                    I have several desks in our company and one of those is used by our HR department. I want to bring through the data to the shared Zoho Analytics workspace - except for the HR desk. Can this be excluded at data import stage ?
                                  • Incoming Emails Not Showing Up in Zoho Inbox

                                    Hi - I have my Zoho email account set up to forward a copy of all incoming emails to a secondary Gmail address, whilst retaining the original email in the Zoho inbox. However, all my incoming emails are currently not showing up in my Zoho inbox, so I'm
                                  • Form Accessibility

                                    Hi, is there an update on the accessibility standard of Zoho forms? Are the forms WCAG 2.1 AA compliant? 
                                  • How to retrieve my following requests on this forum?

                                    Sorry, but I did not find the proper subforum for this question.
                                  • How to list emails in a folder, e.g. Inbox, on multiple pages when using Zoho mail webpage?

                                    Something as shown in the figure. There are totally 50 emails in Sent folder. If "Mail per page" equals 20, then the Sent folder is split into 3 pages. When I wander through Sent folder, I can just select a specific page to jump to. BTW, it seems that
                                  • Unable to Create Zoho Booking via the Book Appointment API

                                    Its giving the below error {     "response": {         "errormessage": "Error setting value for the variable:customer_details\n null",         "status": "Error"     } } Request: POST Url: https://www.zohoapis.in/bookings/v1/json/appointment attached Zoho-oauthtoken
                                  • SHEET - Send email when a cell changes

                                    I would like to create a custom function for Zoho Sheet that triggers when a paticular cell changes to a specific value. This would result in sending an email to a recipient (this would be an address that remains the same and included in the script). Example: = IF(N4= "Drafted", <>EmailFunction) 1)     Cell N4 changes to "Drafted" 2)    Email is sent to recipient            or alternatively 3)    Post to chat channel I have found the Custom function editor in Sheet. I am not bad at scripting, but
                                  • 【開催報告】 福岡 ユーザー交流会 2025/8/8(金)

                                    皆さま、こんにちは。コミュニティチームの中野です。 8/8(金)に、福岡 ユーザー交流会を開催しました。 本投稿では、その様子をお届けします。当日の登壇資料などもこちらに共有しますので、参加できなかった皆さまもご参照ください。 今年初の開催となる福岡 ユーザー交流会では、CreativeStudio樂合同会社 前田さんによるZoho CRM / Sign / Survey の事例セッションのほか、 Zoho社員セッションでは、Zoho Forms の活用法を解説。 さらに、「見込み客・顧客データの管理/活用方法」をテーマに参加者同士でZoho
                                  • hiding a topic from all but one segment (or list)

                                    My organization sends out a number of newsletters using Zoho Campaigns. One of those newsletters is for volunteers. In order to become a volunteer, a person has to first go through our volunteer orientation (training). After that, they can receive newsletters
                                  • no me llegan los correos a Zoho mail

                                    No puedo recibir correos pero sí enviarlos, ya hice la modificación de MX y la verificación de teléfonos, qué es lo que ocurre? gracias
                                  • Error: Invalid login: 535 Authentication Failed

                                    I have used zoho with nodemailer. const transporter = nodemailer.createTransport({ host: 'smtp.zoho.com', port: 465, secure: true, auth: { user: 'example@example.com', pass: 'password' } }); While sending the mail, it shows the following error: Error:
                                  • Zoho Renewal

                                    Hello, If I am not going for zoho email renewal. will i get back my free zoho account? and if yes then is it possible to get back my all free user. how many user get back 10 or 25?
                                  • javax.mail.authenticationfailedexception 535 authentication failed

                                    Hi, I am facing 535 authentication failed error when trying to send email from zoho desktop as well as in webmail. Can you suggest to fix this issue,. Regards, Rekha
                                  • Not reciving emails

                                    Apparently i cannot recive emails on my adress contact@sportperformance.ro I can send, but do not recive. The mail i'm trying to send from mybother adress gets sent and doesn't bounce back... but still doesn't get in my inbox. Please advise
                                  • Not receiving MailChimp verification e-mail

                                    It seems that their verification e-mails are blocked. I can receive their other e-mails, but not their verification of domain ownership e-mail. I've checked and double checked how I typed the e-mail, using different e-mails (my personal e-mail can receive it), white listing the domain and all that is left is for the IP's to be white listed, but I don't have that power.  If a staff member could take a look at this -> http://mailchimp.com/about/ips/ And perhaps white list them for me, that would be
                                  • Creating my 2nd email account

                                    After creating my first email address, I decided to get another email address. I would like to use this new address as the primary address too. I don't know how to set it up there doesn't seem to be an option for that
                                  • Cannot - create more email account - Unusual activity detected from this IP. Please try again after some time

                                    Hello, I come across the error message in Control Panel. Unusual activity detected from this IP. Please try again after some time and i cannot create any more users We are an IT company and we provide service for another company Please unlock us.
                                  • "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain"

                                    Good day. When I try to send mail through ZOHO mail I get the following error : "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain" I need help with this. My zohomail is : @eclipseweb.site Thank you,
                                  • Transfert de domaine pour création des comptes emails

                                    Bonjour , je ne parviens point à créer des mails avec le domaine 'raeses.org' suite à la souscription du domaine auprès d'un autre hébergeur, dont j'ai fait la demande du code de transfert qui est le suivant : J2[U8-l0]p8[ En somme, attente de l'activation
                                  • Next Page