Dynamically Update Picklist Values in Zoho CRM Workflows

Dynamically Update Picklist Values in Zoho CRM Workflows



Hello all!
Welcome back to another interesting Kaizen post.
Today, we will discuss how to add automatically or remove values from a picklist field using Deluge within a workflow. This post serves as a solution for the forum post.

Use case

The sales team migrates users from Pipedrive to Zoho CRM. In Pipedrive, the team managed deals using a Kanban view displayed based on the Closing Months (a picklist field). They automated the updating of picklist values to include current and upcoming months based on the deals' closing timelines. 

In Zoho CRM, to replicate this process, users should manually update the picklist values. The requirement is to automate updating the picklist options during record creation or editing within a workflow.

Solution

By triggering the PATCH Fields API (introduced in V6) through a Deluge function within a workflow, this process can be easily automated. Automating picklist updates saves time, reduces the chances of human error, and ensures that picklist values are always up-to-date.
  • First, create a custom picklist field called "Closing Month" in the Deals module.
  • Then, use the custom picklist along with the Closing Date (a mandatory field date field in the Deals module) within a Deluge function in the Workflow. 
  • The PATCH Fields API can be used within the Deluge function to automate updating picklist values and to list the current and upcoming closing dates in deals.
Let us see the steps in detail on how to achieve this case.

Example

Consider the Closing Month as a custom picklist in the Deals module with three months: January, February, and March. Whenever a new deal is created and its closing month matches one of the picklist values, the record will be updated with the corresponding month in the Closing Month field and placed under the existing picklist value in the Kanban view. If the new closing month is not already in the picklist values, then the Deluge function will automatically create a new picklist value, and the record will fall under the new picklist value section in the Kanban view. 

Follow the steps below to achieve our case in Zoho CRM:
  1. Create a Custom Picklist Field in the Deals module.
  2. Set Up a Workflow.
  3. Add a Deluge Function within a workflow.
  4. Configure the Workflow.

1. Create a Custom Picklist Field in the Deals Module

  • Go to Setup > Customization > Modules and Fields.
  • Select the Deals module and the desired layout where you want to add the picklist.
  • Click on New Fields and then Add New Field.
  • Select Picklist as the field type, name it "Closing Month", and add a list of months (In this post, only three months have been added for example purposes).

                                  
  • Click Done to save the new picklist field.

2. Set Up a Workflow

  • Navigate to Setup > Automation > Workflow Rules.
  • Click on Create Rule, select the Deals module, and name the workflow in the Rule Name.
  • Set the rule to trigger on record creation or update.
                               
The workflow triggers based on the value of the Closing Date in the Deals module, executing the function when the Closing Date is not empty.


3. Add a Deluge Function within a workflow

You can either create a custom function or you can associate an existing one. Below is the Deluge code used within the workflow. 
  1. //To map months with Numbers
  2. month = {1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"June",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"};
  3. //To retrieve the Deal record
  4. dealRecord = zoho.crm.getRecordById("Deals",dealRecordID);
  5. info dealRecord;
  6. //To retrieve the Closing Date
  7. closingDate = dealRecord.get("Closing_Date");
  8. info closingDate; 
  9. //To get the predefined value from the closing month
  10. closingMonth = month.get(closingDate.month());
  11. closingYear = closingDate.year();
  12. //To Format the Month and Year from the Closing Date
  13. picklistValue = closingMonth + " " + closingYear;
  14. info picklistValue;
  15. //Retrieving Current Picklist Values
  16. Dealsfield = invokeurl
  17. [
  18. url :"https://www.zohoapis.com/crm/v7/settings/fields/5725767000003664513?module=deals"
  19. type :GET
  20. connection:"zohocrm"
  21. ];
  22. info Dealsfield;
  23. picklistValues = Dealsfield.get("fields").get(0).get("pick_list_values");
  24. info picklistValues;
  25. //Checking if the Picklist Value Already Exists
  26. flag = false;
  27. for each  option in picklistValues
  28. {
  29. if(option.get("display_value").equals(picklistValue))
  30. {
  31.   flag = true;
  32.   info flag;
  33. }
  34. }
  35. //Adding a New Picklist Value if It Doesn't Exist
  36. if(flag == false)
  37. {
  38. requestBody = Map();
  39. requestList = List();
  40. requestData = Map();
  41. picklist = list();
  42. picklistobj = Map();
  43. picklistobj.put("display_value",picklistValue);
  44. picklist.add(picklistobj);
  45. requestData.put("pick_list_values",picklist);
  46. requestList.add(requestData);
  47. requestBody.put("fields",requestList);
  48. info requestBody + "";
  49. updateField = invokeurl
  50. [
  51.   url :"https://www.zohoapis.com/crm/v7/settings/fields/5725767000003664513?module=deals"
  52.   type :PATCH
  53.   parameters:requestBody + ""
  54.   connection:"zohocrm"
  55. ];
  56. info updateField;
  57. }
  58. //To update the Deal Record
  59. requestBody = Map();
  60. requestList = List();
  61. requestData = Map();
  62. requestData.put("Closing_Month",picklistValue);
  63. requestList.add(requestData);
  64. requestBody.put("data",requestList);
  65. info requestBody + "";
  66. dealreecordUpdate = invokeurl
  67. [
  68. url :"https://www.zohoapis.com/crm/v7/Deals/" + dealRecordID
  69. type :PUT
  70. parameters:requestBody + ""
  71. connection:"zohocrm"
  72. ];
  73. info dealreecordUpdate;


4. Configure the Workflow

Create a custom function by clicking the New Function or associate an existing one to the workflow. In our case, the deluge program has already been written and configured (associated) to the workflow. 

                            
  • Under the workflow actions, select Function and choose the function you created.
  • Ensure that the function is set to run when the workflow is triggered.

Creating a Deal with a Closing Date of January 2nd (Using an Existing Picklist Value)
                                               


Creating a Deal with a Closing Date of April 1st (Adding a New Picklist Value)



The new picklist value, which was not a value previously, has now been added to the picklist.

You can add values to a picklist field using the PATCH Field API. To remove an option from a picklist, use the Update Custom Layout API. Refer to the Sample input to mark picklist options as unused section in the Layouts API documentation.

Cheers!!!

Related Links
Additional Links

      • Recent Topics

      • Zoho CRM Developer Series - Queries

        Hey everyone! We’re excited to invite you to our next Zoho CRM Developer Series focused on Zoho CRM Queries, happening on June 5, 2025 and June 26, 2025. Whether you're working on CRM customizations, integrating with third-party services, or just curious
      • Can't call function with ZML Button

        Hi, I have a page where I have a subform and a button made in ZML. My initial goal is simply that onClick, I call a function that updates multiple entries. Even though the function exist, I am unable to reference it. If I try to reference it manually
      • Team Modules in Zoho CRM: Empower Every Team, Break Silos and Boost Collaboration

        Hello Everyone, The ultimate goal of every business is to achieve customer delight—and achieving customer delight cannot happen with the effort of a single person or team. At Zoho CRM, we believe that it’s a shared mission that spans across your entire
      • Trying to integrate gmail but google keeps blocking Zoho access for integration??

        hi i am trying to integrate a gmail account so can track/access business emails this way. I have followed the instructions but after selecting my email account it gets re-routed to this message (screengrab below) Can anyone advise a way around this or
      • Zoho Projects - Give Project access to developer (external)

        We have a client using Zoho Projects and would like to invite several external users and assign the Projects because the Project tasks are outsourced to other companies. What is the best way to give access to external Users and is there any limitations
      • External calls & email notification limits

        Salut, I was doing some testing of SMS and Email notification yesterday, on the development environment, and got an error due to External calls exceeded. I know that my plan has 100 email & external calls limit, but in my billing page, I do not see those
      • DORA compliance

        For DORA (Digital Operational Resilience Act) compliance, I’ll want to check if Zoho provides specific features or policies aligned with DORA requirements, particularly for managing ICT risk, incident reporting, and ensuring operational resilience in
      • Introducing the Germany Tax Edition !

        Whether you're operating within Germany, trading outside the country, or dealing with customers within or outside the EU, our new Germany Tax Edition makes navigating the complexities of VAT management a cakewalk. Our Germany tax edition allows you to
      • How to get custom estimate field to display on existing or new services?

        I am using FSM. I recently added a new custom field to Service Details to help categorize my services. I can see the newly added field as a column on the service list view. However, when attempting to update an existing or create a new service, I don't
      • Add Support for Google reCAPTCHA v3 in Zoho Forms

        Hello Zoho Forms Team, We appreciate the security measures currently available in Zoho Forms, including Zoho CAPTCHA, Google reCAPTCHA v2 (checkbox), and reCAPTCHA v2 (Invisible). However, we would like to request the addition of support for Google reCAPTCHA
      • Centralized Organization Information Management in Zoho One

        Dear Zoho One Support, I'm writing to propose a feature that would significantly improve the user experience and streamline data management within Zoho One. Current Challenge: Currently, managing organization information across various Zoho One apps requires
      • Please add custom sort in Windows ver. of Notebook!

        Dear Zoho, I love the custom sort (drag and order notes) in the Android version of Notebook, but when I sync onto the Notebook on Windows, the note orders all get messed up because it doesn't support custom sorting yet. This makes it impossible to do
      • Unveiling Zoho CRM's New User Interface - The NextGen UI

        Hello Everyone, Last Wednesday, May 14th,2025, we announced the public release of Zoho CRM For Everyone, our most significant update yet. This release brings a modernized CRM experience with a redesigned user interface, new capabilities for cross-functional
      • Office 365 is marking us as "bulk"

        All of a sudden (like a couple of days ago) all of our customers who are on Office 365 are getting our mails in their junk email. This is not the case with Gmail or other random mail servers, nor between us. We got a 10/10 score on mail-tester.com. Also,
      • Unable to add estimate field to estimate template

        I have the field "SKU" as part of my service data. I can also see it as a column when displaying the list of services. However, I have no way to include it on my estimate template because the field is not showing as a column field to include for the service/part
      • Pivot Table - Zoho Analytics

        I'm creating a Profit and Loss chart in Zoho Analytics using the Pivot Chart feature. While Net Profit can be calculated using the total value, I also need to calculate and display the Gross Profit/Loss directly within the chart. To do this, I need to
      • Including attachments with estimates

        How can attachments be included when an estimate is sent/emailed and when downloaded as a .pdf? Generally speaking, attachments should be included as part of an estimate package. Ultimately, this is also true for work orders and invoices.
      • Add Hebrew Support for Calendar Language in Zoho Forms

        Dear Zoho Forms Team, Greetings! We are using Zoho Forms extensively and appreciate its versatility and ease of use. However, we’ve noticed that the Calendar Language settings currently do not include Hebrew as an option. We would like to request the
      • Ask the Experts 20: Level up your Business with Zia

        Hello everyone! We're excited to reconnect with you again. The recent sessions of our Ask the Experts series have contributed to valuable conversations, beginning at the live sessions and evolving into one-on-one conversations and sessions where we've
      • Invalid URL error when embedded sending url into iframe for my website when using in another region

        Hi team, My site is currently working on integrating your signature feature as part of the system functionality, it's working great but recently there's been a problem like this: After successfully creating the document, i will embed a sending url into
      • Ability to Remove/Change Zoho Creator Admins via Zoho One Interface

        Dear Zoho One Team, Greetings, We would like to request a feature enhancement in Zoho One. Currently, it is not possible to remove or downgrade a user with the Admin role in Zoho Creator from the Zoho One admin interface. Unlike other Zoho apps where
      • Announcing Zoho Community Developer Bootcamps in India – Extensions

        Hey everyone! We're back with another line-up of Zoho Community Developer Bootcamps in India! Following the success of the first leg of bootcamps on Extensions, we're now ready with the second leg. These bootcamps focus on empowering developers of all
      • Company centric layout

        Hey everyone, I want to have an "account-centric" Zoho, where the main part is the "Account" and other parts like "Contacts", "Deals", "Projects" are linked to this "Account". Tricky part is, that I have different layouts for different departments, and
      • CRM HAS BEEN SOOO SLOW For Days 05/15/25

        I have fantastic Wifi speed and have zero issues with other websites, apps, or programs. It takes an excruciatingly amount of time to simply load a record, open an email, compose an email, draft a new template, etc. Am I in a subset/region of subscribers
      • Announcing Zoho Community Developer Bootcamps in India – Catalyst by Zoho

        Hey everyone! Following the success of the first set of bootcamps on SalesIQ Zobot and Extensions last year, we're ready for the next set of bootcamps—this one dedicated to Catalyst by Zoho! These bootcamps are aimed to empower developers to build, scale,
      • Global Fields

        Just like Global Sets for Picklists, we would like to have global fields for any kind of field. Three things that should be saved globally: 1. The Existence of the field 2. The Name and 3. Association with a module should be set up in a respective place
      • Introducing the Zoho Show Windows app

        Hello everyone! We’re excited to announce the launch of the Zoho Show app for Windows! You can now create, access, collaborate on, and deliver presentations right from your desktop. The Windows app brings you all the powerful features you’re familiar
      • Renew an expired subscription

        Hey Zoho officer, My subscription was expired yesterday, but I did not notice until just now. How can I renew the subscription even it is expired? The website is really important for our publicity. So I hope I can still review the domain and website. Thanks!
      • New Action Requests

        Hi, Is there any chances to get the new actions requested at all? I have made a few requests but never heard back from Zoho about them. I assume that developing them take time but is there any support that can provide some update? Thanks
      • Pre-fill webforms in Recruit

        I don't want to use the career site portal (as I have my own already), but I would like to direct users to the application forms for each role, from my website job pages. Is there a way to pre-fill fields in Recruit application forms, so that I only have
      • [Webinar] Deluge Learning Series - AI-Powered Automation using Zoho Deluge and Gemini

        We’re excited to invite you to an exclusive 1-hour webinar where we’ll demonstrate how to bring the power of Google’s Gemini AI into your Zoho ecosystem using Deluge scripting. Whether you're looking to automate data extraction from PDFs or dynamically
      • Does Thrive work with Zoho Billing (Subscriptions)?

        I would like to use Thrive with Zoho Billing Subscriptions but don't see a way to do so. Can someone point me in the right direction? Thank you
      • Workdrive - copy permissions

        I am trying to customize sub folder, which I understand fully from below https://help.zoho.com/portal/en/kb/workdrive/team-folders/manage/articles/customize-folder-permissions-in-a-team-folder#Customize_permissions_during_folder_creation However I want
      • Latência

        Estou com bastante latência 200ms em São Paulo Brasil para o endereço mail.zoho.com, e email demora para carregar as vezes trava como está por ai ? segue print sabem se é normal ? ping
      • US military addresses

        When we have a client with a US military address having them fill in a form is a problem Zoho forms doesnt acommodate them correctly. It doesn't make sense for me to have to create a secondary data model for military addresses. I have placed some links
      • US military addresses

        When we have a client with a US military address having them fill in a form is a problem Zoho forms doesnt acommodate them correctly. It doesn't make sense for me to have to create a secondary data model for military addresses. I have placed some links
      • BANK FEED - MAYBANK , provider from YODLEE IS NOT WORKING

        As per topic, the provider YODLEE is not working for the BANK FEED. It have been reported since 2023 Q3, and second report on 2023 Q4. now almost end of 2024 Q1, and coming to 2024 Q2. Malaysia Bank Maybank is NOT working. can anyone check on this issue?
      • Introducing 'Previous' and 'Next' operators for enhanced date-based filtering

        Hi everyone, We are excited to introduce to you two new operators - Previous and Next - for your date and date time fields in filters as well as in custom view. For starters, let’s say you want to filter records based on Created Time: Previous 6 months:
      • Same users on different accounts

        I have an issue I need help with. Whilst trialing ZOHO CRM I created the following: Account1 using myname@myorganisation.com.au and 2 personal emails Account2 using a personal email and 2 users sales1@myorganisation.com.au and sales2@myorganisation.com.au
      • Rich-text fields in Zoho CRM

        Hello everyone, We're thrilled to announce an important enhancement that will significantly enhance the readability and formatting capabilities of your information: rich text options for multi-line fields. With this update, you can now enjoy a more versatile
      • Next Page