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!




      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          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

                                  • Applications built with Zoho Creator

                                    Hi, I’m really interested in seeing how others have built their application using Zoho Creator, especially those designed for external users (clients, vendors, or the public). If you’ve developed something along those lines and don’t mind sharing, I’d
                                  • Amazon invoice in Zoho Books

                                    I have just made my first few sales on Amazon India. Amazon Seller account generates invoices for the sales made on Amazon. These invoices are sent to customers also. Now when I was only making offline sales, I used to create Invoices in Zoho Book. Now
                                  • Exported Slide Image Lacks Portion of the Background Image

                                    This does not always happen, but when I export (or "download") the rendered image of a slide, it sometimes lacks a portion of the background image. I created a sample slide deck to demonstrate it and shared it with the admins. It is also publicly available
                                  • Sales Order, Invoice and Payment numbers

                                    Hi zoho friends, it is me again, the slow learner. I'm wondering if there is a way to have it so the Sales order, invoice and payment numbers are all the same? It would be easier for me if they were the same number so there is not so many reference numbers
                                  • Items Below Reorder Point Report?

                                    Is there a way to run a report of Items that are below the Reorder Point? I don't see this as a specific report, nor can I figure out how to customize any of the other stock reports to give me this information. Please tell me I'm missing something s
                                  • Enhance Sign CRM integration

                                    Hello all, I'm working on a custom Deluge script to enhance the integration between Zoho CRM and Sign by using a writer merge template for additional flexibility. I want to replicate the post-sign document integration that exists between CRM and Sign
                                  • Passing the CRM

                                    Hi, I am hoping someone can help. I have a zoho form that has a CRM lookup field. I was hoping to send this to my publicly to clients via a text message and the form then attaches the signed form back to the custom module. This work absolutely fine when
                                  • Capture Stripe’s Customer ID

                                    Does anyone know of a way to capture Stripe’s customer ID that is created when the form/payment is processed? I would like to have the customer ID stored in our CRM so we could utilize in some custom functions down the road.
                                  • Shortcut to fill a range of cells

                                    Good evening: I'm writing because I haven't been able to find a feature that allows you to select a range of cells, type in one of them, and then use a key combination to type in all of them. In Excel, the keyboard shortcut is Ctrl+Enter. I haven't found
                                  • External User onboarding for zoho connect is not really intuitive.

                                    So the external user is sent an invite, which has a button that directs them to login to zoho to view the invite, but if they don't have a zoho account, they cannot access that invite, which seems kinda silly, as there is not real way on for them to create
                                  • Playback and Management Enhancements for Zoho Quartz Recordings

                                    Hello Zoho Team, We hope you're all doing well. We would like to submit a feature request related to Zoho Quartz, the tool used to record and share browser sessions with Zoho Support. 🎯 Current Functionality As of now, Zoho Quartz allows users to record
                                  • Bigin Android app update: Zoho Books integration

                                    Hello everyone! We’re excited to introduce Zoho Books integration on the Bigin Android App. Once the integration is completed in the web(bigin.zoho.com), the Zoho Books tab will be visible in detail View of Contacts, Companies, and Pipeline records. The
                                  • IMAP Migration from Gmail

                                    I have been trying to import my email from a Gmail server and keep receiving the following error. I have reduced the security, activated imap and no improvement. The link to the Google support item has not helped. Unable to connect to your account. Please
                                  • Your Incoming has been blocked and the emails will not be fetched in your Zoho account and POP Accounts Click here to get unblocked.

                                    When entering my account, this error is thrown at me, and I deleted a good part of my deleted messages, but I still can not unblock it, I would appreciate your help. reservas@lineasperutravel.com
                                  • Email login error

                                    Login successfully but email page error
                                  • I want to add my other zoho account in same pc

                                    why does zoho restrict me doing many things as i also want to add my second mail account bit its not allowing me to do that
                                  • Request for Creating Multiple Email Accounts on One Mobile Number

                                    Dear Zoho Team, I am planning to shift all my work-related communication to Zoho Mail because of its reliability and features. For my work, I need to create 3–4 separate email accounts for different purposes. Could you please confirm if it is possible
                                  • Automatically Add Recurring Zoho Meeting Events to Zoho Calendar / Zoho Meeting Calendar

                                    Hello Zoho Meeting Team, Hope you are doing well. We would like to request an enhancement regarding recurring meetings created inside Zoho Meeting. At the moment, when we schedule a recurring meeting in Zoho Meeting, it does not appear in Zoho Calendar
                                  • Signature issue

                                    Problem: The signature does not appear when replying or forwarding an email. solve issue: settintgs/Signature Check option place a signature above the content with quotation marks
                                  • Unable to Receive Emails on Zoho Mail After Office 365 Coexistence Setup – Error: 553 Relaying Disallowed

                                    Hello, My domain name is bigniter.com, and I’ve been using Zoho Mail as my email service provider without any issues. Recently, I followed the steps outlined in the Zoho documentation to enable Coexistence with Office 365: 🔗 https://www.zoho.com/mail/help/adminconsole/coexistence-with-office365.html#multi-server
                                  • mail admin not loading

                                    i am trying to login to mailadmin ... gears keeps rotating forever... its not a password issue whats so ever ... not cookies issues whatsoever from android app i can login but there so few things to do from there .. i changed ip address the same... i
                                  • Unify All Zoho Video Meeting Experiences into One Standardized Platform

                                    Hi Zoho Team, We would like to share an important user experience concern regarding the current state of video meeting functionality across the Zoho ecosystem. The Problem Within Zoho, there are multiple ways to initiate or schedule a video meeting: Zoho
                                  • Unify All Zoho Video Meeting Experiences into One Standardized Platform

                                    Hi Zoho Team, We would like to share an important user experience concern regarding the current state of video meeting functionality across the Zoho ecosystem. The Problem Within Zoho, there are multiple ways to initiate or schedule a video meeting: Zoho
                                  • Unify Overlapping Functionalities Across Zoho Products

                                    Hi Zoho One Team, We would like to raise a concern about the current overlap of core functionalities across various Zoho applications. While Zoho offers a rich suite of tools, many applications include similar or identical features—such as shift management,
                                  • Zoho One Backup of entire account

                                    Hello, When using Zoho one is there a way to backup your entire account of all apps that you are using \ activively using in a single step or do you have to backup each applications data individually? Thanks,
                                  • CRM Mobile reports

                                    When our engineers finish a job they like to email the customer a job report. This is best done todate as an email template but we can find no way to include an image field from that module. Is there any other options?
                                  • why cant i access my email account. it keeps asking me for reverifiying my account by entering my password.

                                    I cant access my account. it keeps asking me for reverifcaton by entering my password. once its entered it asks for it over and over.
                                  • Issue with “CC” and “Subject Details” of the initial mail when reply / replied all / forward using Zoho Mail Client (Desktop / Web Mail / Mobile App)

                                    It is observed that when I reply / reply all / forward a mail using Zoho Mail Client (Desktop / Web Mail / Mobile App), the “CC” and “Subject Details” are omitted from the mail which was replied/forwarded. However this is not the case with outlook mail
                                  • Unable to send Emails - 452 4.3.1 Temporary System Error

                                    Whene ever i request smtp server to send the email (without attachment). i recieve error "452 4.3.1 Temporary System Error"
                                  • I can't receive email

                                    I cannot receive any email sent to my Zoho email after the free upgrade plan trial is finished.
                                  • Help for the alisa adding

                                    Sorry, I would like to add a paypal alias on my domain email address. However, the system blocked it. How can I do it?
                                  • Problem with Writer and Workdrive

                                    Hi team, I’m the super admin for our Zoho One org. WorkDrive is active, and Zoho Docs is deprecated for our org. However, Zoho Writer cannot connect to WorkDrive at all — we’ve cleared cache, tried incognito, and restarted several times. I was able to
                                  • Lite plan attachment said 250mb but actually 25mb ?

                                    Lite plan attachment said 250mb but actually 25mb ? I can't attach over 25mb files, and can't receive mails has attached files over 25mb too
                                  • How to change a BAS that has been filed

                                    I have discovered that a group of expense transactions were accidentally placed in a asset account rather than an expense account. As a result I need to adjust the transaction and consequently most of my BAS to correct the error. Because the BAS have
                                  • Zoho Books | Product updates | August 2025

                                    Hello users, We’ve rolled out new features and enhancements in Zoho Books. From the right sidebar where you can manage all your widgets, to integrating Zoho Payments feeds in Zoho Books, explore the updates designed to enhance your bookkeeping experience.
                                  • Closing Accounting Periods - Invoice/Posting dates

                                    Hi, I have seen in another thread but I'm unsure on how the 'transaction locking' works with regards to new and old transactions. When producing monthly accounts if I close December 24 accounts on 8th Jan 25 will transaction locking prevent me from posting
                                  • Feature Request: Email Follow-Up Sequences Similar to Zoho CRM

                                    I’m wondering if Zoho Recruit is planning to introduce a feature similar to the Email Automation – Follow-Up Sequences that is available in Zoho CRM. In CRM, this allows users to send a series of timed follow-up emails triggered by specific actions (for
                                  • Zoho Projects - Visual improvement to parent and sub-task relationship

                                    Hi Projects Team, My feature request is to improve sub-task visibility. Please see screenshot below. I really think parent child relationships could be visually improved. Even if the first letter of the parent task was inline with other same level tasks
                                  • Zoho Projects - Task Owner filter at Project level

                                    Hi Projects Team, The feature requests I would like to raise is the ability to create a custom view at the project level for projects with tasks owned by a user or users. For example "Ashley's Projects" custom view might contain a list of project in which
                                  • Good news! Calendar in Zoho CRM gets a face lift

                                    Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
                                  • Next Page