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 #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

          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

                                  • Automation #6 - Prevent Re-opening of Closed Tickets

                                    This is a monthly series where we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk. Typically when a customer submits
                                  • 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,
                                  • 👍 Zoho CRM's Notes now gets Reactions and a new look

                                    Available in SA and JP DCs. Rolling out to other DCs in phases. Hello everyone, Notes help users capture important updates, collaborate with teammates, and maintain context for records. Now with Note Reactions, users can quickly acknowledge updates, express
                                  • Ability to move emails between different Shared Mailboxes

                                    Hi Zoho Team and Community, I would like to suggest a feature that would greatly improve the workflow for teams managing multiple Shared Mailboxes. Currently, we often receive emails in the wrong shared mailbox. While we can forward them to the correct
                                  • Stay on top of appointments with the Zoho Bookings extension for Zoho Cliq

                                    Greetings from the Zoho Bookings team! We're excited to introduce the Zoho Bookings extension for Zoho Cliq. It keeps your schedule and booking notifications where your conversations happen, helping you stay informed and respond to changes without switching
                                  • 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
                                  • Check out in Meetings

                                    Why there is no check out in Meetings of Zoho CRM, very difficult to track Moderation Update: Meeting Check-out is in our roadmap and is currently in the development analysis phase. Development is yet to start, and we'll post an update here once it
                                  • Custom View - Sort by Custom Field

                                    I created a custom field for our Engineering team to know which tickets to work first by numbering them.  I created a custom view to general data which includes the Engineering Priority.  However, I cannot sort the Engineering Priority column ascending
                                  • Zoho Marketing Automation Cannot Sync Lookiup Fields

                                    Hello all, It seems that Zoho MA cannot sync Lookup fields from the CRM. Can you confirm if this is the case? Is there a workaround? Do you know if Campaigns can sync with custom modules and also with Lookup field in the CRM? Thank you!
                                  • Why does Analytics keep pulling in IDs?

                                    Every time I pull in Job Reference/Name data it inputs it as an ID number instead of the actual name. Its impossible to find anything. Is there a way to fix this?
                                  • Feature request - pin or flag note

                                    Hi, It would be great if you could either pin or flag one or more notes so that they remain visible when there are a bunch of notes and some get hidden in the list. Sometimes you are looking for a particular name that gets lost in a bunch of less important
                                  • 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
                                  • Zoho Assist Remote Desktop on Android grey screen

                                    With Zoho Assist Remote Desktop for Android when I connect to an unattended device I see only a Grey Screen. It worked fine before. This is a recently issue. I tried to clean data and cache, reinstall app, try and old version... but nothing. Always grey
                                  • Global Sets for Multi-Select pick lists

                                    When is this feature coming to Zoho CRM? It would be very useful now we have got used to having it for the normal pick lists.
                                  • Change 'default' project dashboard

                                    Is it possible to change the default project dashboard for all projects? Both in layout and in what widgets are shown? We have a lot of (short-running) projects and I want to quickly see the tasks and milestones when I open a Project, but I don't want to change the layout for all my projects manually. Thanks, Menno
                                  • Unbilled Items from Purchase orders

                                    Hi, I was wondering if there is a way for me to generate a report for the sum amount of unbilled items in open PO or partially billed PO. this info would be helpful for better cash flow management and for foreseeing any issues for unjustified delays for
                                  • Discount Per Item / Option Removed

                                    Hi, I was using Zoho Books for three years now and very saticfied. Now, as we try to add an invoice, we founds that the discount option per item was takn away, and a discount from total was implemented. However, we have cases when we add a diffrent discount to each item. Was this option removed permanently? Thanks, 
                                  • Allow Reauthorizing CRM Connections Without Revoking First

                                    Currently, when a Zoho CRM connection needs to be reauthorized or authorized with another account, we first have to revoke the existing authorization and then authorize it again. This creates a gap where the connection is unavailable, and any functions,
                                  • Zoho Projects - Mobile App - Creating Related Issue On Task View

                                    Hi Projects Team, I'm working with a client who wants to use Zoho Projects for their field service work. So far it is working find (and I am aware of FSM, but the client is happy with Projects). One thing they have raise with me as a frustration is that
                                  • Track All Emails from Company Domain

                                    For our business model, it's almost impossible to keep track of all emails sent to clients, under the way ZohoCRM currently tracks emails to customer records via the user account only. We'd like to see a way of tracking emails via domain only, separate
                                  • Cannot format "start date" field in Zoho Flow

                                    I am trying to recreate a flow that connects Inventory package creation to Zoho projects (where a task is created in a defined project). I've been able to troubleshoot everything EXCEPT the date fields; specifically the "start date" - which is quite important
                                  • Introducing Incentives for Zoho CRM: Build, automate, and track sales commissions

                                    Dear Customers, We are here with an amazing news! We built a direct solution to help manage your commission provisioning activity in your business. From creating commission plans to issuing payouts, this application leverages your sales reps’ performance
                                  • Dark Mode for ZOHO Recruit

                                    Please make a dark mode for ZOHO Recruit. The white is SO BRIGHT!
                                  • Dashboards for Customers

                                    Is it possible to build dashboards for each customers in the community for their tickets?
                                  • Feature Request - Dedicated "Avail" action for Restricted Holidays (instead of routing through Apply Leave)

                                    Currently, Restricted Holidays in Zoho People are handled through the Leave module. Employees have to go through Apply Leave and select the Restricted Holiday as a Leave Type in order to avail it. From an HR perspective, a Restricted Holiday isn't really
                                  • Deleting invoice (not syncing with Xero)

                                    If I delete an invoice or Bill in Zoho Inventory, it doesn't sync with Xero. So my Xero accounts are not correct. Whats the point of being able to delete a transaction in Zoho if it doesn't sync to my accounting package? How can I do this?
                                  • Allow Clients to choose which meeting platform works best for them

                                    Hi! I have a feature request for Zoho Bookings! I currently have multiple online meeting platforms connected to Zoho Bookings: Zoho Meeting, Zoom Meetings and Teams Meetings. Since we are allowed to connect multiple meeting platforms, it would only make
                                  • Implement Meeting Polls in Zoho Bookings

                                    Dear Zoho Bookings Support Team, We'd like to propose a feature enhancement related to appointment scheduling within Zoho Bookings. Current Functionality: Zoho Bookings excels at streamlining individual appointment scheduling. Users can set availability
                                  • Previewing attachments in email composer (Zoho CRM)

                                    When I am sending an email from a contact's record, when I am in the compose email screen, if I add an attachment to the email, I cannot then click on the attachment to view it to see if it is in fact the correct attachment before sending. In Outlook
                                  • Zoho Lens Feature Update: September 2026

                                    RealWear store support Zoho Lens is now listed on the RealWear marketplace, paving the way for quick and easy deployments. Install it straight to your smart glasses from the marketplace without any cables, pendrives, or manual transfers.
                                  • How are you using AI task management tools in your team

                                    AI is becoming more useful when it can do more than suggest tasks. Having AI agents help with task updates, follow-ups, and repetitive project work could make day-to-day collaboration much smoother. I recently came across Sharkly.ai, which focuses on
                                  • Can Zoho Mail Be Used with Google Workspace Without Migrating Emails?

                                    Hello Zoho Community, We currently use Google Workspace for our company emails and do not want to migrate our email accounts or data to Zoho Mail. However, we would like to use Zoho Mail as an email client, similar to Microsoft Outlook, by connecting
                                  • Topic assignment to a contact list never completes in Zoho Campaigns

                                    Hello, I am experiencing an issue in Zoho Campaigns when trying to assign a Topic to a contact list. When I select a list and try to assign a Topic, Zoho displays the following message: “This process will take a few minutes. You will receive an email
                                  • Subforms and automation

                                    If a user updates a field how do we create an automation etc. We have a field for returned parts and i want to get an email when that field is ticked. How please as Zoho tells me no automation on subforms. The Reason- Why having waited for ever for FSM
                                  • [ZohoDesk] Improve Status View with a new editeble kanban view

                                    A kanban view with more information about the ticket and the contact who created the ticket would be valueble. I would like to edit the fields with the ones i like to see at one glance. Like in CRM where you can edit the canvas view, i would like to edit
                                  • Zoho Assist Feature Update: September 2026

                                    Custom View Filters in Scheduled Reports Scheduled Custom Reports now support saved Views. Select a View when setting up your schedule, and only the data matching its filter criteria will be delivered to recipients in each email. Without a selected View,
                                  • Tip #89 – Access, print, and manage remote files from your local printer with Remote Printing – 'Insider Insights'

                                    A team member working from home urgently needs a document that's sitting on the office system. The office is locked and nobody is around to access it. Emailing the file means routing a sensitive document through external channels, and that's not something
                                  • Important: Teamwork Projects Integration Moving to API v3

                                    Hello Teamwork Project users, We are migrating the Teamwork Projects integration from the legacy V1 API to V3 API. This upgrade enables support for custom fields from Teamwork Projects, allowing users to import custom modules and fields into Zoho Analytics
                                  • Introducing Night Mode for Zoho Recruit [BETA]

                                    Late-night hiring sessions? Long hours reviewing resumes? We heard you. Night mode [BETA] is now available in Zoho Recruit, giving you a cleaner, more comfortable workspace that’s easier on the eyes while keeping the focus on what matters most: hiring.
                                  • Sent Items folders not syncing on Thunderbird

                                    HI,  I run TB on multiple devices, since the middle of September all the devices have stopped synchronising the sent items folders, all mail is received and sent correctly and stored in my zoho webfolders. I haven't changed any of the settings. Any ideas? This is also the case in my 'paid for' accounts with ZOHO and Thunderbird Many thanks Tony whittingham
                                  • Next Page