Kaizen #91: Dynamic Lookup filters using Client Script

Kaizen #91: Dynamic Lookup filters using Client Script

Hello everyone!

Welcome back to another captivating Kaizen post.  In this post, we will explore the process of implementing lookup filters using Client Script. 

What is a dynamic lookup filter?

 A dynamic lookup filter is a feature that allows you to specify conditions or rules for filtering the options displayed in a lookup field based on the values of other fields or related data . It dynamically adjusts the available lookup options to provide a more targeted and relevant selection for users.  It enables a more intuitive user experience by presenting only relevant choices based on the user's selections. Not by just using the field value on that page, you can also filter the results of the lookup with current date/time, logged-in user, or any custom condition that you can handle using Client Script. You can achieve this in Create, Edit, Detail (Standard) and Clone pages.

You can apply dynamic filters to the following fields using Client Script.
  • lookup fields
  • sub-form lookup fields 

Use Case 1 -Lookup field filter in a form

Consider a Manufacturing company, ABC. The Admin wants to get the list of accounts that have the Account Type as Vendor for the lookup field name "Linked Account" in the Leads module only for standard layout.

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



 You can filter the list of Accounts visible in the lookup field using the ZDK setcriteria() , so that only the accounts of Account Type Vendor will be visible when the user clicks the lookup icon. 

  • 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.

  var field_obj = ZDK.Page.getField('Linked_Account');
 field_obj.setCriteria("(Account_Type:equals:Vendor)", { filterOnSearch: true });

You should use the ZDK setCriteria  along with the filter condition, in order to apply filters.

setCriteria() ZDK


You can view the ZDK Documentations in the Library section of Client Script IDE

Here is how the Client Script works.




Use Case 2 - Dynamic lookup filter in a sub-form

Zylker is a health care company. The Admin wants to list the available instruments in the lookup field " Instrument Name " based on the type of Instrument that a service agent selects in the field "Type" only for standard layout. For example, if the service agent selects the Type as "Surgical Instruments", then he should be allowed to choose only instruments of such type in the subform.

Solution:

  • 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 .

var Product = ZDK.Page.getSubform("Product_list").getField("Product_Name");
Product.setCriteria("(Product_Category:equals:"+value+")", { filterOnSearch: true });

  • Here, based on the value the user selects in the "Product Category" , the Product Name will be displayed by picking the Instruments from Product module where the category is equal to the user selection.
  • Here is how the Client Script works.

You should use setCriteria ZDK in order to apply filters for lookup fields in Client Script.

Now, you may wonder what about Lookup filters of the field properties in layouts, when to use them and what is the difference.

Here is the comparison which shows when to use lookup filters in Client Script!
( Please note that this comparison holds good as on June 2023, there may be updates made to below features )

Lookup filters in field properties
Lookup filters in Client Script
 
Use this when you want to apply filters based on entity criteria.
Use this when you want to apply filter based on user selected field value.
 
The filter criteria is specific to the module . i.e The lookup  filter will be the same for all the layouts of the module.

The filter criteria is specific to the layout. i.e The lookup filter will be not be the same for all the layouts of the module. 

Sample use case

You can use this when you want to apply filters where you know the values involved in the criteria like 
Created Date is Today, List the Accounts where the account Type is 'Supplier', Modified by Logged in user.

Sample use case

You can use Client Script when the criteria depends on user selection like to list the available instruments in the lookup field "Instrument Name" based on the type of Instrument that user selects in the field "Type". 

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!



    • Sticky Posts

    • 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
    • Kaizen #217 - Actions APIs : Tasks

      Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
    • Kaizen #216 - Actions APIs : Email Notifications

      Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
    • Recent Topics

    • 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.
    • Remove Powered by Zoho at the footer

      Hi, I've read two past tickets regarding this but it seems that the instructions given are outdated. I assume the layout keeps on changing, which makes it frustrating for me to search high and low. Please let me know how exactly do I do this now? Th
    • Kaizen #223 - File Manager in CRM Widget Using ZRC Methods

      Hello, CRM Wizards! Here is what we are improving this week with Kaizen. we will explore the new ZRC (Zoho Request Client) introduced in Widget SDK v1.5, and learn how to use it to build a Related List Widget that integrates with Zoho WorkDrive. It helps
    • Custom module - change from autonumber to name

      I fear I know the answer to this already, but thought I'd ask the question. I created a custom module and instead of having a name as being the primary field, I changed it to an auto-number. I didn't realise that all searches would only show this reference.
    • DKIM (Marketing emails) UNVERIFIED (Zoho One)

      I'm having a problem with Zoho One verifying my Marketing Email DKIM Record for MYFINISHERPHOTOS.COM. I have removed and re-entered the ownership, DKIM (Transactional emails), SPF and Marketing DKIM and all of them come back verified except the DKIM (Marketing
    • How do I get complete email addresses to show?

      I opened a free personal Zoho email account and am concerned that when I enter an email address in the "To", "CC", fields, it changes to a simple first name. This might work well for most people however I do need to see the actual email addresses showing before I can send my messages. Is there something I can do to fix this "feature"? Thanks, JB
    • Campaigns set up and execution assistance

      Hello Community, Can someone recommend a professional who can assist with the completion of my set up and deployment of Campaigns? Looking for a person or company that is not going to ask for big dollars up-front without a guarantee of performance to
    • 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.
    • I can't add a new customer in Zoho invoice? Anyone had this issue before?

      Ive been using Zoho invoice for over 6 years. Today I wanted to add a new customer to send an invoice to but it doesn't save when I try to access it from the pulldown menu when you go to send a new invoice.
    • No Need To Fix Something That Is Working

      Zoho Books is a great financial tool which helps businesses to become more efficient and productive with day-to-day operations. As such, every change, upgrade, improvement needs to be carefully thought before implemented in the software and I'm sure Zoho
    • Creating a task, i can not work out how to get ID for What_Id

      hi From Module A function I map Module B record reference membershipid (ours). I need Module B Zoho ID to create the related to on task. All examples i've seen start with the Zoho ID. void automation.LTM_Assign_Dispute_Task(String membershipid) { try
    • Using email "importance" as workflow-criteria

      I'd like to set up a workflow that triggers if an incoming email has been flagged as "high importance" but I'm not seeing any way to do that. Hopefully I'm just missing something obvious...?
    • What is Resolution Time in Business Hours

      HI, What is the formula used to find the total time spent by an agent on a particular ticket? How is Resolution Time in Business Hours calculated in Zohodesk? As we need to find out the time spent on the ticket's solution by an agent we seek your assistance
    • Check & Unchecked Task Segregation in Export

      It must have a feature to represent checked and unchecked tasks as [ ] and [✅] respectively when exporting it to Arratai or WhatsApp ; as Keep Notes by Google contains…
    • WorkDrive Download Issue

      My client has been sending me files via WorkDrive, which generally has worked fine. Recently files won't download at all. If you try and individually select and download a file, a popup will appear in the bottom right saying it's preparing and then it
    • Feature Request: Add Tax ID Display on Event Tickets

      Hello Backstage Team, I’ve had several clients bring up an issue regarding tax compliance when creating events. For tax purposes, they are required to show their Tax ID on the event tickets. Currently, this isn’t an option, so they have to manually generate
    • Resolution Time Report

      From data to decisions: A deep dive into ticketing system reports What are time-based reports? Time-based reports are valuable tools that help us understand how well things are going by breaking down key metrics over specific periods. By tracking, measuring,
    • Support Custom Background in Zoho Cliq Video Calls and Meetings

      Hello Zoho Cliq Team, We hope you are doing well. We would like to request an enhancement to the video background capabilities in Zoho Cliq, specifically the ability to upload and use custom backgrounds. Current Limitation At present, Zoho Cliq allows
    • Add RTL (Right-to-Left) Text Direction Button in Zoho Cliq

      Greetings Zoho Team, We would like to request the addition of an RTL (Right-to-Left) text direction button in Zoho Cliq, similar to what is already available in other Zoho apps like Zoho Desk. Currently, while using Zoho Cliq with the English interface,
    • Enable Backgrounds and Video Filters for 1:1 Cliq Calls Across All Zoho Entry

      Hello Zoho Cliq Team, We hope you are doing well. We would like to request an enhancement related specifically to 1:1 video calls in Zoho Cliq. Current Behavior Zoho Cliq currently provides background and video filter options in the following scenarios:
    • Client Script | Update - Client Script Support For Custom Buttons

      Hello everyone! We are excited to announce one of the most requested features - Client Script support for Custom Buttons. This enhancement lets you run custom logic on button actions, giving you greater flexibility and control over your user interactions.
    • Proposal: Actionable API Error Messages to Reduce Support Ticket Volume

      I've encountered a long-standing frustration with how Zoho Creator's API communicates errors to developers, and I'm hoping the Zoho team can address this in a future update. This issue has persisted for over 9 years based on community discussions, and
    • Zoho Flow: Stripe a Zoho Marketing Automation

      Hola! Quiero hacer un flujo con Zoho Flow, para que cuando se haga un pago en Stripe, añada el lead en Zoho Marketing Automation. Lo he configurado, configurando el disparador como "Payment created" y mapeando el campo de Stripe "Receipt email address".
    • Not able to delete a QC nor able to revert or create a cycle of manufacturing for QC failed Jobs

      Not able to delete a QC nor able to revert or create a cycle of manufacturing for QC failed Jobs
    • Need Customer Item Inward Module along with QC

      Need Customer Item Inward Module along with QC 1. Using Transfer Orders hit the item balance sheet 2. Items without inventory it becomes difficult for tracking purpose. 3. Custom Modules become tedious to capture multiple items, item subforms are not
    • LESS_THAN_MIN_OCCURANCE - code 2945

      Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
    • Introducing Radio Buttons and Numeric Range Sliders in Zoho CRM

      Release update: Currently out for CN, JN, AU and CA DCs (Free and standard editions) Hello everyone, We are pleased to share with you that Zoho CRM's Layout Editor now includes two new field formats— Radio Buttons and Sliders for Numeric Fields. These
    • Zoho CRM for Everyone's NextGen UI Gets an Upgrade

      Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
    • Deluge Function to Update Custom Field

      I'm trying to get a Deluge function (which will run as part of a Schedule in Desk) that retrieves all tickets with the status "Recurring" and updates the custom field checkbox "cf_recurring" to "true". Here's what I have, which doesn't work: searchValue
    • Zoho email

      I need a list of email addresses of all contacts on my zoho
    • Error: Invalid Element tax_override_preference

      In both Books and Inventory, we're getting the following error whenever we try to enter any Bill: I think this is a bug. Even cloning an old bill (that obviously was entered just fine), this error occurs.
    • WhatsApp IM in Zoho Desk always routes to Admin instead of assigned agent

      Hello Zoho Experts, I connected WhatsApp IM to my Zoho Desk account. I only assigned my Customer Service (CS) agent to the WhatsApp channel, and I did NOT include Admin in this channel. However, every new WhatsApp conversation automatically gets assigned
    • Shift-Centric View for Assigning and Managing Shifts in Zoho People

      Hello Zoho People Product Team, Greetings and hope you are doing well. This feature request is related to Zoho People - please don't move it to zoho one! We would like to submit a feature request regarding the shift assignment and management view in Zoho
    • Zoho Sheet for Desktop

      Does Zoho plans to develop a Desktop version of Sheet that installs on the computer like was done with Writer?
    • Introducing parent-child ticketing in Zoho Desk [Early access]

      Hello Zoho Desk users! We have introduced the parent-child ticketing system to help customer service teams ensure efficient resolution of issues involving multiple, related tickets. You can now combine repetitive and interconnected tickets into parent-child
    • cant upload images in signature- urgent help needed. ta!

      HI, I have been trying to insert the company logo in the signature. i have tried it several times since yesterday, the longest I waited was 1 hour and 12 minutes for the pop up window to upload a 180 KB .jpg file. what am i doing wrong.. an urgent reply
    • Add Ticket button in Home view

      When I go to the My Tickets or the Knowledge Base view in our Help Centre, the Add Ticket button is available, but not in the Home view. I would really like for it to be displayed in the Home view as well. Is this possible? Thanks.
    • Problem using Zoho Desk API

      Goodmorning, I am trying to use the Zoho Desk API to create a dashboard in Grafana, but I am having a problem. Following the instructions in the API documentation, I created the API Console application (server-based application). Then I created the string
    • Add zoho calendar to google calendar

      Hi I keep seeing instructions on how to sync Zoho CRM calendar with google calendar but no instructions on how to view Zoho calendar in my google calendar.
    • City field suggestion in Zoho Books

      Hi team, We are using Customers module in Zoho Books. In the Address section, we want to understand whether the City field can show suggestions while typing using any API or built-in feature. For example, if a user types “Mum”, can the system suggest
    • Next Page