Custom Validation for Blueprint to Enforce Mandatory File Uploads and File Extension C

Custom Validation for Blueprint to Enforce Mandatory File Uploads and File Extension C



Welcome to another exciting Kaizen post on Client Script!

Have you ever wanted more control over what gets uploaded to a File or Image field in Zoho CRM, like restricting file types, validating file names, or showing a custom error before an inappropriate file gets saved? 

Client Script now supports File Upload and Image Upload fields, giving you greater control over file validation and user experience.

In today's post, let's see how to make a file upload field mandatory in a Blueprint using Client Script, a solution to the question raised in our community forum.

In this Kaizen post,


  1. Use Case
  2. Solution
  3. Supported ZDKs
  4. Summary
  5. Related Links


1. Use Case

In the Deals module, Zylker Logistics uses a Blueprint with the transition "Needs Analysis" to "Deal Accepted" or "Deal Rejected". Sales agents were clicking this transition without uploading the Order Confirmation file, which caused downstream OCR automation to fail and forced the ops team to manually chase missing documents later. To fix this, the admin wants to check whether the Order Confirmation field has a file attached whenever a user tries to perform the transition. If no file is attached, the transition should be blocked and an error message should prompt the user to upload the file first. Additionally, if a file is attached, it should be a PDF only. This way, a Deal can only move to next transition once a valid PDF confirmation document has actually been uploaded.




2. Solution

This use case can be solved using Client Script. All you have to do is create a Client Script with the "beforeTransition" event for the Deals module. 
  1. Go to Setup > Developer Space > Client Script. Click +New Script . Specify the details to create a script and click Next.

  1. Enter the following script and click Save.

  1. // Check if the current blueprint transition being triggered is "Deal Accepted" or "Deal Rejected"
  2. if (transition.name == "Deal Accepted" || transition.name == "Deal Rejected") {

  3.     // Get the value of the Test field (file upload field)
  4.     var objectArray = ZDK.Page.getField('Test').getValue();

  5.     // Log the field value to console for debugging purposes
  6.     log(objectArray);

  7.     // Check if the field is empty - covers empty string, null, and empty array cases
  8.     if ((objectArray == '' || objectArray == null || objectArray == '[]')) {

  9.         // Show an error message to the user if no file is attached
  10.         ZDK.Client.showMessage("Upload a **valid Proposal Document PDF** to proceed", error)

  11.         // Stop/block the blueprint transition since validation failed
  12.         return false;

  13.     }
  14.     else {

  15.         // If a file is attached, get the name of the first uploaded file
  16.         var fileName = objectArray[0].File_Name;
  17.         log(fileName);

  18.         // Extract the file extension from the file name and convert it to lowercase
  19.         var extension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
  20.       
  21.  // Check if the uploaded file's extension is not "pdf"
  22.         if (extension != "pdf") {

  23.             // Show an error message asking the user to upload a valid PDF file
  24.             ZDK.Client.showMessage("The Proposal Document field accepts **only PDF files**. Please select a **.pdf file** and try again.", error);

  25.             // Stop/block the blueprint transition since the file is not a PDF
  26.             return false;
  27.         }
  28.     }
  29. }

This script runs before the "Deal Accepted" or "Deal Rejected" blueprint transition. It checks whether the Proposal Document field has a file attached. If the field is empty, it shows an error and blocks the transition. If a file is attached, it checks the file's extension. If the extension isn't "pdf", it shows an error and blocks the transition; otherwise, the transition proceeds normally.

Notes
Note:
The value of a File Upload field is an array of objects, even when only a single file is uploaded. Therefore, access the required file object (for example, objectArray[0]) before retrieving its properties, such as File_Name

  1. Here is how the Client Script works when no file is uploaded to the Proposal Document field.




  1. Here is how the Client Script works when a GIF file is uploaded to the Proposal Document field.



  1. If a valid PDF file is uploaded, the transition goes through smoothly without any issues.



3. Supported ZDKs

For File Upload and Image Upload fields, as of now only the following ZDKs are currently supported:

getValue() – Retrieves the file details currently populated in the File Upload or Image Upload field.
setValue() – Sets or updates the value of the File Upload or Image Upload field.

4. Summary

In this Kaizen post, we discussed:
  1. How to validate a file's extension and stop a Blueprint transition based on it.
  2. How to check whether a file has been uploaded using Client Script.
  3. ZDKs that can be used for File Upload and Image Upload fields.





      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

          • 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 #261 : Using Zoho CRM Skill to generate complex COQL queries

            Hello everyone, In the previous Kaizen posts, we introduced the zoho-crm SKILL.md and discussed how it can help you when you are working with Zoho CRM APIs and Client Script. In this Kaizen, we will focus on using the Zoho CRM `SKILL.md` with GitHub Copilot
          • 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

          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 Mail MCP connector

                                    Issue: Zoho Mail MCP connector (https://mail-organization-930963415.zohomcp.com/mcp/.../message) — OAuth authorization completes successfully in-browser ("Authentication successful"), but the issued token is rejected when the MCP client reconnects to
                                  • Zoho Books | Product updates | October 2026

                                    Hello users, October brings a range of new features and enhancements to Zoho Books, designed to simplify compliance, streamline accounting workflows, and improve inventory management. From the launch of the Nigeria Edition and France’s e-invoicing capabilities
                                  • Multiple criteria in searchRecords

                                    Hi, is it possible to search with multiple criteria in zoho.crm.searchRecords? I have tried several variations of the following without much success. CustomerRecord = zoho.crm.searchRecords("Contacts", "(First Name|=| lee)" && "(Last Name|=| spencer)"); Thanks. Chris
                                  • Plans to make "Generate Presentation with Zia AI" available as API endpoint?

                                    This 'Generate Presentation with Zia' feature has great potential, and we would like to be able to trigger it automatically from a workflow. https://show.zoho.com/home/ziaai/generate Is there already a way to trigger this via API? If not, is there any
                                  • How to setup noreply@ example.com

                                    How do I setup noreply@example.com so the mail never gets delivered. I currently have a catchall setup aswell.
                                  • Pleas unblock E-Mail-Adress service@montana-energie.de / kontakt@montana-energie.de

                                    Dear Zoho Support, Could you please unblock service@montana-energie.de / kontakt@montana-energie.de which belongs to a regular customer with whom we are having frequent business-related conversations. Thank you very much in advance, Erdem Kar homewise
                                  • Unable to change alias in the from field on the ZOHO mac app

                                    I have 1 main mail address, and 3 alias's. on the web mailbox when I create a new email, I can select the alias's from the dropdown in the from field. On the app no dropdown is available.
                                  • Zmail mobile application

                                    ho do i remove people from this app
                                  • My allies email (info@xxxx.com) was been deleted by system, and I can not build the same info allies email now

                                    Dear Zoho Mail Support Team, I am the super administrator of the Zoho organization 【Organization Name, as shown in Admin Console】. I am writing to report an urgent issue with two of our custom-domain email addresses and to request your help restoring
                                  • Cannot create mail account

                                    Hi, i have a problem, i can't create a mail account every time i try the error massage like this Oops! Something went wrong during mailbox creation. Please try again please help
                                  • Amazon.it always ends up in spam

                                    Emails from amazon.it always end up in the spam folder, even though I have added the domain and the various individual Amazon addresses for shipping, payments, and other matters to the trusted lists at the user administrator level. What should I che
                                  • Your Authenticate email domain (SPF, DKIM, DMARC) is bad to say the least

                                    How about actual instructions rather than vague generalities? There is no way to complete this with what is provided. Please provide specific verifiable steps.
                                  • Generate a Zoho Sign link

                                    From time to time I get a response "I never received your you e-document for electronic signature" is there a way to generate a Zoho Sign link to share.
                                  • 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
                                  • Zeptomail in the blacklists

                                    Hello, I noticed some hard bounces while sending emails, and upon checking the details, I see that we have been added to the blacklists of certain spam lists: Bounce category: Policy failure Reason: ip-issues Message: 5.7.1 Service unavailable; client
                                  • Zoho Desk training for administrators in EU and US region

                                    Hello Everyone, Get ready for the certified Virtual Classroom training for our Zoho Desk users in Europe and the US. Our in-house Zoho Desk expert, @Dheeraj | Zoho Desk, will conduct the virtual classroom training. This training focuses on simplifying
                                  • Possible to reorder Pipelines position?

                                    I have multiple Pipelines and want to reorder their positions, so that in the Deals module record for the Pipeline field, I have them ordered in a certain way. Is there a way to reorder the position of the Pipelines without deleting existing Pipelines
                                  • Categorize Items with Item Headers

                                    Hello customers, Did you ever want to classify items based on specific categories to help your customers understand your invoice better? With the new Item Header feature, you can easily categorize items in your invoices and estimates and give them a common title.  Item Headers are available in the Invoices, the Recurring Invoices and the Estimates module. It can be carried forward from estimates to invoices at the time of converting the estimates.  To add an item header: Go to the Estimates, Invoices
                                  • Gettting "You are Offline" Messages all the time

                                    Al of a sudden, a few days ago, I suddenly began getting a message on the bottom left side of the Mail App saying "You are Offline". Why? Does it mean I'm not getting incoming mails now? why is has started?
                                  • Zoho CRM Quotes – Subform and PDF/Writer Limitations

                                    Hello, I am encountering the following limitations in Zoho CRM Quotes: Custom product images cannot be uploaded in the subform – the image upload field cannot be added; only the file upload field is available. File upload placeholders cannot be used in
                                  • Invoice Only Shipped Items

                                    Dear Zoho, We are a company that deals with sales orders with 600-1000 lines We need to be able to do partial invoicing based on shipped items Right now when we click convert to invoice we can not only select items that have een shipped It takes hours
                                  • Alias Email Id already exists

                                    Hi, I just verified my domain sesque (dot) com and now I am trying to create the admin account using admin (at) sesque (dot) com, but I am getting an error saying "Alias Email Id already exists". I used to have another Zoho account with this email address,
                                  • Allow widgets to be placed between native sections in the Ticket Properties panel

                                    One of our biggest frustrations with the Tickets module is how rigid the Ticket Properties panel is. Every section there is built only from native Zoho Desk fields. We can add sections, rearrange fields, and pick layouts, but we can’t put anything custom
                                  • Show backordered items on packing slip

                                    We send out a lot of large orders, and often there are one or two things backordered. How can I fix the packing slips to show quantity ordered  & quantity packed There should also be the ability to "ship" 0 of an item so the receiver knows that things
                                  • Deleted Module

                                    I accidentally deleted a module and its fields. Im trying to get it back. Thanks to Youtubers flooding the internet with out of date videos I can't find how to get deleted modules back. The Recycle Bin doesn't have modules. Anyone know how to do thi
                                  • Set department automatically for incoming calls

                                    Is it possible, when receiving an incoming call through Zoho Desk (using Twilio integration), for the department to be auto-selected based on the phone line being called? Currently, we have to manually select the department from the dropdown menu when
                                  • Make better hiring decisions with Compare Applications and Zia Insights (Beta)

                                    When multiple candidates apply for different job openings, evaluating each application against the right job requirements can take time. Reviewing resumes, candidate details, and interview feedback separately can make it harder to assess role fit and
                                  • Support Plan: Recuring Issue

                                    Hi Zoho Team, Could you please look into this recurring alert and provide clarification on why this restriction is still in place? This issue has become a bottleneck in our workflow, significantly limiting our automation capabilities. We are unable to
                                  • mail sent to gmail goes directly to spam

                                    Hi TKIM and SPF are configured and verified. E-mails coming from zoho to my personal gmail account are going directly to the spam folder. How can I solve this? I can send you guys the headers privately if you need to.
                                  • Creating packages according to actual shipping processes

                                    Hi community. I would like to ask a question to see if there's a better method or workflow for the creation of packages in Zoho Inventory. There is a little confusion in some of Zoho's language relating to the use of term Packing Slip when connected to
                                  • mail

                                    We want our tracked links in campaign and journey emails to use our own domain instead of the shared maillist-manage.net domain. We have already created the CNAME links.rexven.com → customer-campaign.zoho.com (DNS only). Does our plan support a custom
                                  • Zoho Webinar - Sharing System Audio (NOT AVAILABLE)

                                    Hi, We are having a serious problem with Zoho Webinar. In the webinars we run, we very often share the audio from a video we are streaming directly from YouTube or other applications. Until recently we were using Zoom, but as we use other Zoho applications
                                  • Ad-hoc approvals are now available in CRM approval processes

                                    Released for all DCs. Hello everyone, We've introduced ad-hoc approvals in CRM approval processes. This enhancement lets approvers add additional approvers when needed, without changing the configured approval workflow. How the approval process works
                                  • Introducing PRM: Build, manage, and scale your partner ecosystem

                                    Growing a partner ecosystem is a good problem to have. What starts as a handful of partners can quickly turn into a maze of spreadsheets, emails, and disconnected processes. More partners mean more opportunities, greater reach, and new ways to grow
                                  • Data Subject Requests in Zoho Mail: Retrieve and export email data for legal and compliance needs

                                    Organizations are often required to retrieve specific email communication data in response to legal investigations or compliance audits. The Data Subject Requests (DSR) feature in the Zoho Mail Admin Console allows administrators to search for all email
                                  • Introducing live chat for Zoho CommunitySpaces

                                    Hello everyone, We’re happy to announce that your community members now have a direct line to you. Zoho CommunitySpaces now has a live chat widget, powered by Zoho SalesIQ, so a member can open a chat from your community and get a quick one-to-one answer
                                  • Moving software

                                    I need someone to customize zoho for my moving business I need to do the following . 1. Quote comes in from ezemove website or we enter customer details into the system 2. Email quote to customer based on hourly rate 3. Customer accepts quote deposit is taken 4. We convert the quote into a confirmation email and add job to the diary and assign resources to the job 5. Job gets completed and we enter invoice amount into the system and email the invoice Budget : neg | Duration : 1 month To leave a private
                                  • How To Create a Report with Subforms from Two Modules

                                    I want to create a report based on data in subforms over 2 separate modules. Can this be done? I tried to do it in Analytics, but one is a date field that needs to be grouped by month, and it doesn't look like Analytics can do this.
                                  • Introducing Zoho Commerce 2.0 — It's more than just selling!

                                    Hello! We are proud to launch Zoho Commerce 2.0, a reimagination of how online businesses look, feel, and function. This launch is both timely and symbolic, as we reaffirm our commitment to empowering small and medium enterprises with powerful, yet simple-to-use
                                  • Domain sparkylab.co.kr still linked to an old Zoho account after ownership verification - release pending 2+ days

                                    Hello Zoho team, I own the domain sparkylab.co.kr (registered and managed through Gabia, a Korean registrar) and I am trying to add it to my own Zoho organization (SparkyLab) on the Forever Free plan. When I add the domain at mailadmin.zoho.com/hosting?plan=free,
                                  • Next Page