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

    • How do you map a user picklist field to another user picklist field.

      In Zoho Projects, I'm trying to map a custom field (user picklist) in Task Details to a field (user picklist) in the Project Details. How do you get the two to map to each other? This is what I currently have that works for my other fields but doesn't
    • Writing Checks to Employees for Reimbursable Expenses

      I couldn't find a way to write a check through books or expense to an employee for reimbursable expenses. The expense created an entry in the system with a debit (expense) credit (liability). I entered a bill and used the liability account so it would
    • 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
    • Flutter Plugin Compatibility Issue: Unresolved Reference to FlutterPluginRegistry in zohodesk_portal_apikit

      I am integrating the zohodesk_portal_apikit Flutter plugin (version 2.2.1) into my Flutter project, but I am encountering a build error related to an unresolved reference to FlutterPluginRegistry in the file ZDPBaseActivityAwarePlugin.kt. Below is the
    • Automate Ticket Assignment to Contact or Account Owner Using Custom Action

      Teltroz Inc specializes in data science, data analytics, and big data technologies. Serving a wide range of customers from large to medium-sized businesses, security has been their top priority. The firm uses Zoho Desk to enhance their business operations,
    • Zoho Payroll: Product Updates for India - May 2025

      This May, we are glad to unveil new capabilities in Zoho Payroll that simplify your payroll activities. Here's the list: Let Employees Choose Their Tax Deduction Method for One-Time Payments Calculate variable earnings based on percentage of CTC Carry
    • Increase size of description editor when creating new ticket

      Please can you consider making the description editor in the create new ticket form a resizeable area as by default, it is very small and there appears to be no way to increase the size of it.
    • how to remove email headers from Zoho Desk emails and replies from customers?

      I'm testing Zoho Desk at the moment ant noticed some very annoying with the emails that go back and forth, the email headers are always included on the conversation in the web interface and the customer also receives emails with these readers showing
    • [Zoho Flow] Problem using "Send document for signing"

      Hi, I get the error "Zoho Writer says \"An Internal Server Error occurred while processing this request.\"" cant understand what exactly the problem is. Any ideas? Thank you KR, Victoria
    • File Upload and Add via API

      I've been attempting to upload to via the Files api and I have been hitting the wall with actually getting the file to attach. What type is the API expecting ? Base64 Encoded ? When I do I get a 414 Error. I would appreciate your help as I am currently
    • Is this a valid email from Zoho or a scam?

      Hi, I received an email advising me to update MX records for Zoho mail. Is it legitimate? Thanks, Nelson. Dear Admin, You may know that your domain (eg, yourcompany.com) has an MX record that points to an email server configured to process email for your domain. We have noticed that some of our customers have used Zoho IP address (instead of DNS server name) in their MX records to specify the mail server. This is NOT recommended practice. Vendors will sometimes change IP addresses for number of valid
    • 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
    • Add Pinned Tickets to top of queue

      As an IT Helpdesk, we have some tickets where they will need to be looked at daily over a week or 2, and the ability to pin a ticket to the front/top of the queue would be handy as we can be reminded to take a look, rather than placing them on hold and
    • Holding Shift to keep selected tickets

      It is annoying trying to change the category of tickets and then closing them. You have to select them one by one, no way to 'hold down left click and drag your mouse down to select multiple'. Once you have selected them and you change the category, you
    • 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
    • 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.
    • What’s New in Zoho Inventory | April 2025

      Hello users, April has been a big month in Zoho Inventory! We’ve rolled out powerful new features to help you streamline production, optimise stock management, and tailor your workflows. While several updates bring helpful enhancements, three major additions
    • Formula Module how to convert to percentage

      Hello There, I have create a formula field and i want the outcome to be in percentage how do i do that This is my formula ${Deals.Forecast Revenue Per Year}/${Deals.Annual Processing Volume} I have try ${Deals.Forecast Revenue Per Year}/${Deals.Annual
    • 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
    • Error "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required"

      Hi, I'm trying to send an email via the SMTP server using C# code but getting the following error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required" I know the username and password are correct and I can login via the web interface an send email via this account no problems. Here is my code - can any body shed any light on why this would happen? Putting an invalid password gives the same error. I also have disabled
    • Existing subform data is being changed when new subform entries are added

      I'm having trouble with existing subform data being changed when new subform entries are created. I have the following setup to track registrations for a girl scout troop: Main Form: Child Subform: Registrations The data are a one-to-many relationship where each Child record has many Registrations (new Registration will be created for each year the child is in the troop.) Per the instructions, I have created the subfom, added it to the main form, gone back to the subform and created the bi-directional
    • 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
    • How to add a contact ID to contacts I'm importing with migration

      New user, business owner here, not a data specialist. I'm attempting to migrate import data from my old CRM, Daylite, via a .csv file. I feel like I've mapped the columns in the .csv file, however when I click save and next, I get a message saying the
    • FSM Job Sheets data to CRM

      Hello, is there anyway of getting the data collected in the job sheets into the CRM. We are collecting inspection data which we were using zoho forms for but the job sheets in fsm seem like a lot better way to collect it but we need to be able to get
    • Whats the Time out Limit for API Calls from Deluge?

      Hi Creator Devs, We are making API calls to third party server via Deluge. Getting this error message: Error at line : 24, The task has been terminated since the API call is taking too long to respond. Please try again after sometime. Whats the default
    • Footer in PDF template doesn't stay at the bottom of the page

      When setting up a PDF template there is an option for a header / footer. The header stays at the top of the page however the footer does not. It appears the footer actually serves no purpose as it seems to rise up to underneath the header (see image). Is there a way to lock the footer to the bottom of the page? Otherwise what is the point of it? Image demonstrating what I mean. https://ibb.co/cJY1xZ4
    • Hiring Staff Accountant in San Diego with ZohoBooks Experience

      Hello, We are a San Diego, CA company looking for an experienced Staff accountant or controller that has ZohoBooks experience for a full-time position. Please reach out if interested. Best, Ben
    • 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
    • Third party apps for my mail

      Hello im new here and i have a very important issue. A third party company uses one of my emails to send invoices to our customers. My problem is that cannot connect to zoho mail server. my imap settings are corrent imappro.zoho.eu 993 smtppto.zoho.eu
    • Deal Product reference

      Hello All, I'm trying to use Zoho Writer to dynamically create a statement of work document. Our statement of work is heavily dependent on what products are included in the deal. As such, I need to be able to add or remove sections of text depending on
    • Kit Items Breaking Automations - "Provide mapped components for all kit items"

      This has been brought up in other threads, but I believe this issue warrants its own topic. Whenever a sales document (Estimate, Sales Order, Invoice) is created or manipulated programmatically, trying to include a Kit as an Item throws this error: "Provide
    • Outage?

      Is there an outage? Everytime I try to access Zoho FSM (web, as admin) I get a blank screen.
    • How to set the value of the Phone field importing contacts in Zoho Desk

      Hi everyone, i'm new in Zoho Desk, we're setting up the environment and i'm importing contacts from another CRM using a file CSV and i'm getting a problem with phone numbers (italian): the leading zero is cut away, also if the value is inside double quotes.
    • Have you checked your Email headers for DKIM Failure?

      Have you taken a look at your email headers for DKIM failures even with DKIM set up properly? I've had DKIM successfully set up for many months. My account currently shows Email Verified and Authenticated. Big green check marks. Email Relay is also showing
    • If Formula with Abs and Now included!

      Hi all, Having a bit of trouble with an If formula when creating a formula field with currency return type. This is what I've got: If(Now()>=${Agreement History.Rent Review Due}, '${Agreement History.Holdover Price}', 'Abs(${Agreement History.Rent Achieved
    • How to normalize CRM module when integrating with Survey?

      This question is about the problem with many-to-many relationships and Survey. One of the things our organization does is track people in our program and their jobs. We get new information from the people three times annually through Zoho Surveys. Survey
    • IMPORTRANGE Spreadsheets

      I am trying to importrange a spreadsheet into another, but an error keep appearing saying NOT LINKED. Noting that I've linked it. I've tried to publish both sheets and re-apply the formula many times but nothing is working. I don't know what can I do
    • Zoho Desk to Jira > Automatic Creation ?

      I've set up the integration for Jira and Zoho Desk, but when I create a test ticket as a customer nothing is sent to Jira automatically - is this correct ? I can manually link to Jira using the "More Actions", but I was expecting the issue to be created
    • How to create Comparison across Period chart in a dashboard?

      Hi all How can I create this chart in a custom dashboard? The issue for me is that this chart is very small. The CRM module (unlike Projects module) has no ability to expand a chart. I want to make it larger, but also want to include it in a custom Forecast
    • Trouble fetching custom fields from Zoho Booking

      I'm following the instructions from here : https://help.zoho.com/portal/en/kb/flow/user-guide/app-specific-documentation/articles/zoho-bookings#1_Problem_with_accessing_custom_fields But I can't get this to work. Here is the result of a test booking :
    • Next Page