Kaizen #154 - Dynamically Update Picklist Values in Zoho CRM Workflows

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

    • Forecast UI improvements

      Hi I have two improvement requests for the UI in the Forecast function. Can you add the ability to reorganise the Pipeline, Committed and Best Case columns on the Forecast? I thought they were in alphabetical order, so we renamed them so that we could
    • Missing services/ features / buttons

      Hello, 1. I can't locate the DKIM information in ZoHo CRM that I need to add as txt strings to our DNS in GoDaddy. 2. In other activities I cannot locate the 'Help' button for context senstivie help 3. I wish to merge two records into a single record
    • [Free Webinar] Building Data Relationships Using Lookup Fields - Creator Tech Connect

      Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
    • Episode I : Exploring the World of Custom Functions in Zoho Desk

      Hello Again! Welcome to an Automation Adventure in the World of Zoho Desk Join us on a journey to explore how custom functions can enhance and extend the capabilities of Zoho Desk. Automation is everywhere. From robotic arms assembling products on factory
    • Free Webinar - Overview of Zoho Sign and latest updates- May 2025

      Hello there! What's the digital alternative to endless paperwork? Zoho Sign. Designed for digital-first businesses, Zoho Sign is a complete digital signature solution with powerful features and seamless integrations that streamline your entire workflow.
    • Multiple Forecast configurations

      Hi all Is it possible to have multiple Forecast Configurations? That is, not just multiple forecasts, but rather different forecasts assigned to different configurations? The use case here is that we currently have the Forecast module configured for Revenue
    • Discussions from Ask The Experts 19: Inside Zoho Desk Spring Release 2025 : Zia in Focus

      Hello everyone, We had insightful discussions in both the sessions of Ask the Experts(ATE) 19, diving deep into engaging conversations around Zia and the spring release. Your enthusiastic participation and thought-provoking questions brought the sessions
    • Basic campaign set-up

      I have been trying hard to get Zoho CRM and Zoho Mail connected, but somewhere I seem to have wires loose in my brain. I'm not winning. Could anyone just show me (1) how to set up a scheduled email campaign (test to only six internal staff), (2) how to
    • Add template Categories Qoutes sendmale

      Is there other way to add other template categories in sendmail qoute?
    • Report categories not appearing in pie chart

      I have created a simple report to display all of the accounts in our CRM in a certain region, broken down by their 'account type' field. I have displayed this data as a donut chart Highlighted in red in the top left, you can see there are a total of 968
    • Asking for the implementation roadmap or step-by-step guide

      Hello everyone, I'm a freelancer who's been hired to implement Zoho CRM for a client, and I want to make sure I approach this correctly. Could someone kindly share a comprehensive implementation roadmap or step-by-step guide that covers all the essential
    • Sort By Date - Deluge

      I have the following code, which normally works to sort calls by created time. Every once in a while, it doesn't work and something sneaks through in the wrong order and I can't figure out why. calls = zoho.crm.searchRecords("Calls","(Owner:equals:" +
    • Automatic needs analysis for the Deals module

      Good day, I need to get the following functionality in the Deals module: 1. add a Analysis of Customer Needs (ACN) to each transaction 2. the ACN must have a unique number, preferably automatic 3. the ACN must link to the Deal 4. the ACN is completed
    • Odd differential in Accounting and Physical Stock

      Hi there, Around six months ago we noticed that there was an error in one of our product's stock values. Despite seemingly having no outwards requests unfufilled for this item (I.E, no stock committed any longer at the moment), Accounting Stock is -1
    • 7008 Request rate limit exceeded. Please retry again later.

      Hello, I'm encountering an issue with the request limit for my function calls. The function is triggered whenever a new record is created, and in many cases, we create these records in bulk (around 50 at a time). For each record, a workflow is initiated
    • Tip #34- How to Configure Proxy Settings for Unattended Access in Zoho Assist- 'Insider Insights'

      Hey Zoho Assist Community! For those using Zoho Assist's Unattended Access feature, you may come across a need to configure your device through a proxy server. This setup is particularly useful if your network requires strict proxy configurations for
    • Let's Take Custom Slideshow A Step Further!

      Zoho Show comes with this useful feature called Custom Slideshow. It is, as implied by the name, a feature for slideshowing. I would argue it is a waste to use the feature just for slideshowing. For a custom slideshow, you define a subset of slides. Of
    • Copy Address button customisation

      Hi I'm very new to Zoho CRM and need some help regarding Addresses - specifically in relation to the "Copy Address" buttons available within the Contacts and Potentials edit screens.   The majority of my Leads will have both a Mailing Address and a Physical street Address that I need to capture at Lead creation stage.   On conversion of the Lead (to Contact/Account and Potential) I need the following to occur:   In Potentials I need to display ·         Physical Address only   In Accounts I need
    • Add Ability to Set Full Name When Inviting Users to Private Client Portals

      Hi Zoho Creator Team, We hope you're doing well. We’d like to request a usability improvement for client portal invitations in Zoho Creator. When setting up a client portal with the "Private" Portal Type (where only users invited by the admin can access
    • email address issue

      Hi! I am start using zoho to start my company's email marketing campaign, but I can not send the email because is showing that Your email address is already configured as a sender address in another account. But I created a new business email address
    • Can Zia summarize fields?

      A great use case of AI for me would be summarizing company descriptions. We often get long winded descriptions from databases or scraping websites, then reduce them to a couple of sentences stating what a company actually does. Is there any way within
    • Difference between the file extensions .zdoc and .zwriterlink

      I am using Workdrive TrueSync on my windows pc to open files directly from my windows without having to open them from the workdrive web. But, I found something strange, I also have the zoho writer app installed on my windows and if I create a document
    • Deluge should permit a connection to be set with a variable

      Hello, Being one who occasionally likes to post code in the forums, I try to make anything that the end user needs to define be present at the very top of the script so that those who want to implement the script won't have to hunt through lines of code,
    • Items (products) Export to PDF Feature as a Catalog Generator

      Would like to request a product catalog feature where the admin can export "items" along with selected attributes (e.g.: product name, size, price, etc) in a professional template as a PDF document.  Since product pictures and the product attributes are already saved in our system DB, it would be a natural extension to just export it out as a catalog for customers.  I've been duplicating this feature in other apps to make a product catalog.  Having a central repository of "items" makes good sense,
    • Allow SO Item table to search other fields in items to make entry easier

      We have thousands of items, some of which need to be entered on the fly by desk people. We don't want abstracts like the vendor's part number in our SKU or Item name. It would make order entry much easier if the context search in the items table would
    • Zoho Inventory Amazon Integration

      The Zoho Developer Account is not valid for Amazon UK and returns this response whilst set up: This Developer Account Number 861444729264 is not valid for the GB marketplace
    • Sales by Customer

      Hi There, I am looking to generate a report that shows the total value of the sales made to our customers, but does not show each transaction i.e. Customer A = $100,000 Customer B = $50000 and so on This is based on a "Closed Won" in the Deals Module.
    • Enhance Bot Functionality for Scheduled Reminders

      Dear Zoho Cliq Team, We are writing to request an enhancement to the bot functionality within Zoho Cliq. Currently, bots can be added to channels and send messages, but they lack the ability to schedule reminders. Our team utilizes a deluge code to send
    • Zoho Expense - Update Expense Report through web API

      Hello, I am currently having issues updating fields in expense reports (not individual expenses) through the API as described in the API documentation. When I make that request using the invokeAPI Deluge function, I receive a response from the API saying
    • How to switch templates in Zoho Commerce

      I have set up a template in Zoho Commerce and would like to change it. How do I do this?
    • How to use filters on all products page? Or even a category page?

      Hello, I am trying to create some filters so users can use filters to find products they are looking for. So what i am trying is to create a filter according to price lets say. So if i define it this way i am expecting to see this filter option on category
    • How to show product categories on side menu?

      Every time I add a category it appears on the main menu. I would like the main menu for things like contact us, blog etc.. and a side menu to the left of the screen for product categories. How do I make them appear in a side menu or even in a category
    • How to Add Custom Sections in the Product Page?

      Hi Zoho team, I’m currently using the Tranquil theme on Zoho Commerce and I have a question regarding the product page layout. Right now, under each product, I can see expandable sections like Product Details and Specifications. I’d like to add two additional
    • Unable to validate DMARC for the email

      I have recently started to use the ZOHO CRM tool and I'm currently on free trial period. However, when I tried to test the email, it was landing in SPAM or JUNK folder of the recipient's inbox. I learnt about the DMARC, so i have completed SPF and DKIM
    • Migrating Shopify Customers and Tags to Zoho Commerce

      I’m exploring options for migrating our existing Shopify customer accounts into the Zoho Commerce member portal. Specifically, I have a few questions: API Availability: Is there a public API or supported endpoint that allows us to import Shopify users
    • Multilingual website feature

      Would be a great feature to have. I saw that this feature was available for backstage. I think it could be done for zoho sites too.
    • Feature Suggestion for Zoho Social: Auto-reply to Comments or Keywords

      Hi Zoho team, I'd like to suggest a very specific feature that would be extremely helpful for customer engagement: the ability to automatically send a reply to comments on posts — either all comments or those containing specific keywords. For example,
    • How Can i Add Email campaign for my UAEVisaOnline.center website

      Hello Team, i want to create email campaign for our website https://www.uaevisaonline.center but can't able to add. Its showing error like please try after some time. Can you please help and solve the issue. Thanks!
    • The domain Etihaduaevisa.com which you have entered belongs to a different deployment/region

      Hi Team, I am trying to set up a business email account to Zoho for www.etihaduaevisa.com but it doesn't allow me There is a message that pops out The domain which you have entered belongs to a different deployment/region Kindly assist me with this. Thank
    • Outlook not recognising Zoho Inbound server

      I have been receiving my ZOHO emails using MS Outllok on my iPhone and PC, but since Friday 2nd May, incoming emails are not arriving via Outlook and I get the error message saying the server is 'not responding'. Have ZOHO changed the settings for the
    • Next Page