Perform Field Updates during Blueprint transition via Client Script

Perform Field Updates during Blueprint transition via Client Script



Hello everyone!

Welcome back to another exciting Kaizen post.
One of the questions we received through your Kaizen feedback was: 

“How can I update fields before Blueprint transition and how to prevent a transition based on a condition using Client Script?”

 In today’s post, let’s walk through how to achieve this with a simple real-world example. 
We have previously explored how to use Blueprint Events in this Kaizen post and how to implement custom validations within a Blueprint in another Kaizen post.
In this Kaizen post, 


In this Kaizen post, 

1. Use Case
        A. Field Update during Blueprint Transition
        B. Prevent Transition
2. Solution
3. Summary
4. Related Links



1. Use Case

Lisa, the CRM Admin at Zylker, wants to enhance the Lead follow-up Blueprint by capturing the reason behind each transition. Before any transition, a popup should prompt the user to enter a comment.

Field Update:
The Description field should act as the comment history for all Blueprint transitions. When a user enters a comment during a transition, the system should append the comment along with the transition name and the user’s name to this field if the comment has more than 25 characters.

Prevent Transition:
If the comment is less than 25 characters, the transition should be prevented.

2. Solution: 

  • To achieve this, you should create a Client Script that runs during the beforeTransition Blueprint event in your Blueprint.
  • The Before Transition event allows you to control what happens just before a Blueprint transition is executed, and this is perfect for tasks like validating inputs or updating fields dynamically.
  • 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. // Show a popup input asking the user to enter comments
  2. var notes_pop_up = ZDK.Client.getInput(
  3.     [{ type: 'text', label: 'Comments' }], // Input type and label
  4.     'Deal',                                // Title of the popup
  5.     'OK',                                  // Confirm button text
  6.     'Cancel'                               // Cancel button text
  7. );

  8. // Get the "Description" field from the current record
  9. var notes_field = ZDK.Page.getField("Description");

  10. // Check if the input comment length is greater than 25 characters
  11. if (notes_pop_up.length > 25) {

  12.     // If the Blueprint transition is "Gather Details", create a new description with just this comment
  13.     if (transition.name == "Gather Details") {
  14.         var desc = transition.name + "- " + notes_pop_up + ",";
  15.     } 
  16.     // For other transitions, append the new comment to the existing description along with the user name
  17.     else {
  18.         var desc = notes_field.getValue() + " ,\n '" + transition.name + "' - " + notes_pop_up + " - " + $Crm.user.full_name;
  19.     }

  20.     // Fetch the Lead record using the record ID from the page
  21.     var lead = ZDK.Apps.CRM.Leads.fetchById($Page.record_id);

  22.     // Update the Description field of the lead
  23.     lead.Description = desc;

  24.     // Save the updated lead record
  25.     var response = ZDK.Apps.CRM.Leads.updateById(lead, $Page.record_id);

  26. // If comment length is less than or equal to 25 characters, prevent the transition
  27. else {
  28.     ZDK.Client.showAlert("Enter minimum of 25 characters to proceed");
  29.     return false; // Block transition
  30. }

  • To prompt the user for comments during a Blueprint transition, use ZDK.Client.getInput(), which displays a popup input box.
  • The existing value of the Description field can be fetched using ZDK.Page.getField("Description").
  • To retrieve full lead details based on the current record, call ZDK.Apps.CRM.Leads.fetchById() using $Page.record_id.
  • Once the new comment is prepared, update the lead by calling ZDK.Apps.CRM.Leads.updateById().
  • If the entered comment is too short (e.g., under 25 characters), the code displays an alert using ZDK.Client.showAlert() to guide the user.
  • The user’s full name is accessed via $Crm.user.full_name.
  • Finally, return false will stop the Blueprint transition if the number of characters is less than 25.
  • Here is how the Client Script works if the user specifies a description with sufficient length.


  • As you can see in the following gif, if the user enters a short description, the Client Script shows an alert and prevents the Blueprint transition.



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.
Click here for more details on Client Script in Zoho CRM.

3. Summary

A. How can I update fields during a Blueprint transition using Client Script
B. How to prevent Blueprint transition

4. Related Links

Best practices of Client Script 

Happy Client Scripting!

    • 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
      • Recent Topics

      • Zoho Books - Hide Convert to Sales Order if it can't be used.

        Hi Books team, I noticed that it is not possible to convert a Quote to a Sales Order when a Quote is not yet marked as accepted. My idea is to not show the Convert to Sales Order button when it is not possible to use it, or show it in a grey inactive
      • Can't find imported leads

        Hi There I have imported leads into the CRM via a .xls document, and the import is showing up as having been successful, however - when I try and locate the leads in the CRM system, I cannot find them.  1. There are no filters applied  2. They are not
      • Custom Button Disappearing in mobile view | Zoho CRM Canvas

        I'm working in Zoho CRM Canvas to create a custom view for our sales team. One of the features I'm adding is a custom button that opens the leads address in another tab. I've had no issue with this in the desktop view, but in the mobile view the button
      • The connected workflow is a great idea just needs Projects Integrations

        I just discovered the connected workflows in CRM and its a Great Idea i wish it was integrated with Zoho Projects I will explain our use case I am already trying to do something like connected workflow with zoho flow Our requirement was to Create a Task
      • Rich Text For Notes in Zoho CRM

        Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
      • Clone a Module??

        I am giong to repurpose the Vendors module but would like to have a separate but very similar module for another group of contacts called Buyers. I have already repurposed Contacts to Sellers. Is it possible to clone (make a duplicate) module of Vendors
      • Updating Subform Record from other Form

        Just wanted to ask how to properly approach this. I have 2 forms and would like to trigger an auto update on the subform once record submitted. block below only updates 1 row for each recordRow in input.AV_System { AssetRecord = Site_Asset_Services[SOR_No
      • Zoho Projects MCP Feedback

        I've started using the MCP connector with Zoho Projects, and the features that exist really do work quite well - I feel this is going to be a major update to the Zoho Ecosystem. In projects a major missing feature is the ability to manage, (especially
      • Function #10: Update item prices automatically based on the last transaction created

        In businesses, item prices are not always fixed and can fluctuate due to various factors. If you find yourself manually adjusting the item rates every time they change, we have the ideal time-saving solution for you. In today's post, we bring you custom
      • New Mandatory One-Click Unsubscribe Link Overshadowing Custom Unsubscribe Link

        I was recently informed by Zoho CRM Support that they are now mandated by the large email service providers like Google and Yahoo to provide a one-click unsubscribe option in the header (not the body) of all mass emails. I have a custom unsubscribe link
      • Office 365 and CRM mail integration: permission required

        Has anyone run into this weird problem? My email server is Office 365. When I try to configure Zoho CRM to use this server, a Microsoft popup window opens requesting user and password. After entering that, I get a message in the Microsoft window saying
      • Introducing Profile Summary: Faster Candidate Insights with Zia

        We’re excited to launch Profile Summary, a powerful new feature in Zoho Recruit that transforms how you review candidate profiles. What used to take minutes of resume scanning can now be assessed in seconds—thanks to Zia. A Quick Example Say you’re hiring
      • Inventory to Xero Invocie Sync Issues

        Has anyone had an issue with Invoices not syncing to Xero. It seems to be an issue when there is VAT on a shipping cost, but I cannot be 100% as the error is vague: "Unable to export Invoice 'INV-000053' as the account mapped with some items does not
      • email template

        How do I create and save an email template
      • Enhancements in Portal User Group creation flow

        Hello everyone, Before introducing new Portal features, here are some changes to the UI of Portals page to improve the user experience. Some tabs and options have been repositioned so that users can better access the functionalities of the feature. From
      • Archiving Contacts

        How do I archive a list of contacts, or individual contacts?
      • How do I filter contacts by account parameters?

        Need to filter a contact view according to account parameter, eg account type. Without this filter users are overwhelmed with irrelevant contacts. Workaround is to create a custom 'Contact Type' field but this unbearable duplicity as the information already
      • Can I add Conditional merge tags on my Templates?

        Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
      • Zoho CRM button to download images from image upload field

        Hello, I am trying to create a button in Zoho CRM that I can place in my record details view for each record and use it to download all images in the image upload fields. I tried deluge, client scripts and even with a widget, but feel lost, could not
      • Unveiling Cadences: Redefining CRM interactions with automated sequential follow-ups

        Last modified on 01/04/2024: Cadences is now available for all Zoho CRM users in all data centres (DCs). Note that it was previously an early access feature, available only upon request, and was also known as Cadences Studio. As of April 1, 2024, it's
      • blank page after login

        blank page after logging into my email account Thanks you
      • Introducing the revamped What's New page

        Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
      • Function #9: Copy attachments of Sales Order to Purchase Order on conversion

        This week, we have written a custom function that automatically copies the attachments uploaded for a sales order to the corresponding purchase order after you convert it. Here's how to configure it in your Zoho Books organization. Custom Function: Hit
      • RingCentral/Zoho CRM integration

        Hi I would like to know if our RingCentral/Zoho CRM integration will record incoming calls from clients to my mobile number. I have both Ringcenral and Zoho CRM apps on my iPhone. I know it records the outgoing calls I make and shows them in Zoho CRM
      • Free webinar: Security that works: Building resilience for the AI-powered workforce

        Hello there, Did you know that more than 51% of organizations worldwide have experienced one or more security breaches, each costing over $1 million in losses or incident response? In today’s threat landscape, simply playing defense is no longer enough.
      • Range names in Zoho Sheet are BROKEN!

        Hi - you've pushed an update that has broken range names. A previously working spreadsheet now returns errors because the range names are not updating the values correctly. I've shared a video with the support desk to illustrate the problem. This spreadsheet
      • 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
      • Retainer Invoice.

        Why ZOHO not have facilities to deduct partially advance payment from an invoice.
      • Cant Save Gauge on Creator Page

        How to Save Gauge on Creator Page see movie https://vimeo.com/1116410860?share=copy#t=0
      • Granular Email Forwarding Controls in Zoho Mail (Admin Console and Zoho One)

        Hello Zoho Mail Team, How are you? At present, the Zoho Mail Admin Console allows administrators to configure email forwarding for an entire mailbox, forwarding all incoming emails to another address. This is helpful for delegation or backup purposes,
      • Apply Advance option not shown in report

        We are facing an issue in Zoho Expenses. While approving an Expense Report, the "Apply Advance" option is not appearing under the three dots (More Options). Details: Module: Expense Reports Issue: "Apply Advance" option not visible Status of Report: Awaiting
      • Introducing Assemblies and Kits in Zoho Inventory

        Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
      • Auto Capitalize First Letter of Words

        Hi I am completely new to ZOHO and am trying to build a database. How can i make it when a address is entered into a form field like this: main st it automatically changes is to show: Main St Thank You
      • Follow-up emails via Workflow Automation not staying in the same thread

        Dear Zoho Support Team, I am currently using Workflow Automation in Zoho Campaigns to send follow-up emails. In my test case, I noticed the following behavior: All emails in the automation have the same subject line. If the follow-up email is sent within
      • Client Script refuses to set an initial value in Subform field

        I tried a very simple, 1 line client script to set a default value in a custom subform field when the "Add Row" button is clicked and the user is entering data. It does not work - can someone tell me why? ZDK documentation suggests this should be doable.
      • Zoho Expense - The ability to add detail to a Trip during booking

        As an admin, I would like the ability to add more detail to the approved Trips. At present a requestor can add flights, accommodation details and suggest their preferences. It would be great if the exact details of the trip could be added either by the
      • Week date range in pivot table

        Hello, I need to create a report that breakouts the data by week.  I am using the pivot table report, and breaking out the date by week, however the date is displayed as 'Week 1 2014' format.  Is there anyway to get the actual dates in there? ex. 1/6/2014-1/12/2014 Thanks,
      • Help Center IFrame Issue

        I have had a working Help Center on my website using an iframe for a while. But now for some reason the sign in page gets a refused to connect error. Can someone please help. If I go to the url manually it works correclty
      • Staff rules

        Hi! Do you people know what are the default staff rules when a new booking is created? We have two staff members in my team (me as the admin, and my employee). As we share the same services, I'm wondering how Zoho will pick the staff for new apointments.
      • Comment Templates

        Is it possible to add a template option for comments? We have some agents in the process who's responses require a pre-formatted layout. It would be incredibly handy to have a template for them where they can insert the template and then add their responses
      • Next Page