Episode IV:Handling User Inputs in custom functions

Episode IV:Handling User Inputs in custom functions

Hi Everyone,

We've been exploring custom functions which help in performing advanced automation tasks. Custom functions enable you to achieve possibilities based on your organization's requirements. Custom functions require user inputs that allow the function to operate specifically for your organization based on the data provided.

The User Inputs section

Zoho Desk team provides you custom functions in a uniform code format. We have the "user inputs section" at the beginning of most of our custom functions.
The code below demonstrates what the User Inputs section looks like in custom functions. The User inputs section lets you feed in customized inputs based on your organization/portal.
  1. // ----<<<< User Inputs format>>>>----
  2. logs = Map();
  3. deskUrl = "https://desk.zoho.com";  //Replace .com the domain based on your DC
  4. Orgid = "***********" //replace with org ID
  5. cfApiName = "cf_field_name";// replace with the API name of the custom field
  6. departmentId = ***********;// Replace *********** with your department Id
  7. templateId = "enter_the_email_template_id";
  8.  
  9. from_email = "enter_the_from_email_address";
  10. // ----<<<< Code Section >>>>----
  11.  
  12. logs.insert("templateId":templateId);
  13. if(templateId != "")
  14. {
  15. // info templateId;
 
Here's how you can add your portal-based inputs to the custom function:
  1. // ----<<<< User Inputs with data >>>>----
  2. logs = Map()
  3. deskUrl = "https://desk.zoho.au";  //DC is au
  4. Orgid = "10000000x7" //replace with the complete org ID
  5. cfApiName = "cf_country_name";// replaced with the API name of the field Country name.
  6. departmentId = 29x0x0x0x0x0x9;// Replace *********** with your department Id
  7. templateId = "1x3x00xx9x8xxx0x0x";
  8. from_email = "1x4x00xx1x0xxx0x0x";
  9. // ----<<<< Code Section >>>>----
  10. logs.insert("templateId":templateId);
  11. if(templateId != "")
  12. {
  13. // info templateId;

What makes the 'User Inputs' section valuable in custom functions?

Some developers prefer to include user inputs directly within the code in every line.  However, using the dedicated User Inputs section offers several advantages: it keeps your code clean, enhances efficiency, and separates hard-coded values from the logic, making your custom function more manageable and easier to maintain.
In the User Inputs section, you’ll need to replace the sample values or placeholders with actual data. This is necessary because the Arguments option in the Custom Function script provides access to only a limited set of field values. In most cases, inputs such as Org ID, ticket ID, and API names must be entered in the User Inputs section to ensure the function runs correctly and is tailored to your organization/portal.

User Inputs: where to get the required values?

This section explores how to fetch the user inputs required for specific parameters.  These inputs play a key role in helping you code custom functions tailored to your needs. In most cases, they include IDs related to your organization, tickets, custom views, departments, holiday lists, and more; each referring to a unique record ID within the Zoho Desk platform.

1. Zoho Desk Domain

Many user inputs begin with "replace .com based on the your DC".
The easy way to find your DC(data center) or location is from the browser's URL. Login to your Zoho account via this link, your DC is present after accounts. zoho.
For example : deskURL = "https://desk.zoho.com";
If your DC is IN, replace .com with in in the deskURL like this "https://desk.zoho.in"Based on your DC : eu/au/in, replace .com with the respective DC alone.


2. Org ID

To get the Org ID of your Zoho Desk portal, go to Setup >> APIs under Developer Space. You will find the Org ID under the API Plan details.

3. Ticket ID

To get the ticket ID, go to Tickets >> open the ticket for which you want the ticket ID. In the browser's URL, you will find an 18-digit number  after the "/tickets/details/" section, which is the ticket ID of the particular opened ticket.



4. Contact ID

To fetch the contact ID, go to Customers and choose the contact for which you wish to find the Contact ID. In the browser's URL, you will find an 18-digit number at the end of the URL after the "/contacts/details/" section. This is the contact ID for the selected contact.



5. Account ID

To get the Account ID, click on Customers in your Zoho Desk portal, then click on Account on the bottom left of the window. Click on the account for which you want the account ID. Once the account is displayed, the 18-digit number at the end of the browser's URL after "/accounts/details/" is the Account ID for the selected account.


6. Agent ID

To fetch the Agent ID, go to Setup (S) >> User Management >> Agents. You can search the Agent using the Search space on the top left. Select the Agent for detailed view. The 18 digit number in the browser URL at the end after the "/user-control/agents/" is the Agent ID of the selected ID.


7.  Department ID

Navigate to Setup >> Organization >> Departments >> select the department for which you want to fetch the ID. The URL in the browser has the department ID after the "/general/departments/" section.


8. Help Center ID

To fetch the ID of the Help Center, go to Setup >> Channels >> Help Center >> select the Help Center for which you want to fetch the Help Center ID, then click Customization. Now the browser URL will have the 18-digit number between #setup/channels/  <Help Center ID> and /hcCustomize.


9. ID of Business hours

To get the ID for a business hour configured, go to Setup >> Organization >> Business Hours. Select the Business hour to view the Business hour page. The browser's URL will have the business hour ID after "/businesshours/edit/" section.


10. ID of a Holiday list

To get the ID of the Holiday Lists configured, go to Setup >> Organization >> Holiday Lists. Click on the Edit button in the Holiday list to view the Holiday list page. You will find the Holiday list ID next to "/holidaylist/edit/" in the browser URL.


11. Email template ID

Navigate to Setup >> Customization >> Email Templates. Click on the Email template for which you need the ID. Once you've selected the Email template, you can locate the Email template ID in the URL of the email template page. It is found after the "/emailtemplates/edit/" section.
 

12. Custom field API name

When custom functions are triggered based on  a specific field or a custom field created, they require the field's API name to be included in the user inputs.
To fetch the API names, go to Setup >> Customization >> Layouts and Fields >> Field list. You will find the API name for the respective Field Name in the Fields list. 

13. Custom view ID

Some custom functions operate based on a custom view you've created. To execute the custom function based on the custom view within your portal, you'll need the custom view ID.
To fetch the ID of the Custom View, select the Module where you created the Custom View >> Views >> choose the custom view, right click on the page and select inspect. Click on Network in the Inspect tab. Click clear to clear the Network tab. Click Save on the custom view. In the Network console, the first 16 digit number you see is the Custom view ID. Click on the ID to view the headers, you can confirm the ID here.
To fetch the Custom View ID:
  1. Navigate to the module where the custom view was created.
  2. Go to Views and select the desired custom view. Click Edit on the custom view.
  3. Right-click on the page and select Inspect to open the developer tools. Click the Network tab.Click on Click Clear to empty the Network logs.
  4. Now, click Save on the Custom View. In the Network console, look for the first 16-digit number—this is the Custom View ID.
  5. Click on that entry to view the Headers, where you can confirm the ID.
 
With this episode, we bring the custom function series to a close.

Here are the links to visit the previous episodes:

We’d love to hear how these inputs have helped you! If there are any topics you'd like us to focus on, share them in the comments below.
Until the next post, see you soon!
Lydia | Zoho Desk


      • Sticky Posts

      • Register for Zoho Desk Beta Community

        With the start of the year, we have decided to take a small step in making the life of our customers a little easier. We now have easy access to all our upcoming features and a faster way to request for beta access. We open betas for some of our features
      • Share your Zoho Desk story with us!

        Tell us how you use Zoho Desk for your business and inspire others with your story. Be it a simple workflow rule that helps you navigate complex processes or a macro that saves your team a lot of time; share it here and help the community learn and grow with shared knowledge. 
      • Tip #1: Learn to pick the right channels

        Mail, live chat, telephony, social media, web forms—there are so many support channels out there. Trying to pick the right channels to offer your customers can get pretty confusing. Emails are most useful when the customer wants to put things on record. However, escalated or complicated issues should not be resolved over email because it's slow and impersonal.  When you need immediate responses, live chat is more suitable. It's also quick and convenient, so it's the go-to channel for small issues. 
      • Welcome to Zoho Desk Community - Say hello here!

        Hello everyone! Though we have been here for a while, it’s time to formally establish the Zoho Desk Community; we’re really happy to have you all here! This can be the place where you take a moment to introduce yourself to the rest of the community. We’d love to hear all about you, what you do, what company or industry you work for, how you use Zoho Desk and anything else that you will like to share! Here’s a little about me. I am Chinmayee. I have been associated with Zoho since 2014. I joined here
      • Webinar 1: Blueprint for Customer Service

        With the launch of a host of new features in Zoho Desk, we thought it’ll be great to have a few webinars to help our customers make the most of them. We’re starting off with our most talked about feature, Blueprint in Zoho Desk. You can register for the Blueprint webinar here: The webinar will be delivered by our in-house product experts. This is a good opportunity to ask questions to our experts and understand how Blueprint can help you automate your service processes. We look forward to seeing

        • Recent Topics

        • Mobile Chat Window - Full Screen

          Hello, The mobile chat window takes up the full screen, which is highly confusing for most customers! Using a desktop machine, I see the same happens when reducing the browser width to 800px or below. This suggests that it responsive web design, causing the switch to full screen. Can we fix this very annoying behaviour ourselves using a custom css file? If so, can you please let me know how? Thanks
        • Is it possible to customize ZC Themes?

          I understand you can choose a layout and customize Brand Color, App Header, Menu, and Sub-Menu components, but can you override some of the default theme settings with CSS or a config file? For example, - Table highlight color - Listview auto filter highlight
        • Is it possible to create Custom function-based Lookup field in Zoho CRM

          Is it possible to create a custom function-based lookup field in Zoho CRM? If so, how? Use case: Need to fetch users from Zoho Projects into a dropdown field in Zoho CRM.
        • @mention in comments no notification

          Hi, hope someone can help. When we @mention someone in the comments in Zoho Creator, how is that user notifed as we don't get anything on email or in the app notifications. 
        • Add "Running Balance" column to Account Transaction Reports

          Hello, Currently Zoho Account Transaction Reports give you the opening balance, then lists the transactions, then provides the closing balance.  It would be great if you could add a column on the far right that shows the "Running Balance" on the account after each transaction.  There are many times when analyzing or tie-ing out transactions that this would be very helpful.  I currently have to frequently run a tape on my adding machine to get balance totals after a specific transaction on the list.
        • Unified customer portal login

          As I'm a Zoho One subscriber I can provide my customers with portal access to many of the Zoho apps. However, the customer must have a separate login for each app, which may be difficult for them to manage and frustrating as all they understand is that
        • WhatsApp Channels in Zoho Campaigns

          Now that Meta has opened WhatsApp Channels globally, will you add it to Zoho Campaigns? It's another top channel for marketing communications as email and SMS. Thanks.
        • error : Object code : 6500

          b3 = map(); b3.put("name", "Test Project Name"); updateprojects2 = invokeurl [ url :"https://projectsapi.zoho.eu/restapi/portal/era0130/projects/169495000000928007/" type :PUT parameters: b3 connection:"in2" ]; info b3 ; info updateprojects2; ------------
        • I got unknown charge from Zoho

          Good day, I need help disputing a charge I don't know from, zoho. I have ZohoMail and ZeptoMail. I purchase credits for ZeptoMail, and for ZohoMail I am not subcribed.
        • How can I see content of system generated mails from zBooks?

          System generated mails for offers or invices appear in the mail tab of the designated customer. How can I view the content? It also doesn't appear in zMail sent folder.
        • Zadarma + Zoho CRM Integration – Missed Calls Saved as Contacts Instead of Leads

          Hello everyone, I’m looking for input from anyone with experience using the Zadarma + Zoho CRM integration. Currently, I’m seeing that missed calls are automatically being created as Contacts instead of Leads. From a CRM perspective, this doesn’t make
        • Function 56: Automatically enable the option for customers to pay via bank account

          Hello everyone and welcome back to our series! One of the key features of Zoho Books is its integration with multiple payment gateways, allowing you to receive online payments for your invoices. This ensures faster payments, automates payment tracking
        • Attach Files to Your Notecards and share them on the go!

          Hey everyone! We’re excited to share a feature many of you have been asking for — you can now attach files directly to your text notecards and share with ease! 🙌 This update was built with your feedback in mind, especially for those who wanted a simple
        • Can i connect 2 instagram accounts to 1 brand?

          Can i connect 2 instagram accounts to 1 brand? Or Do i need to create 2 brands for that? also under what subscription package will this apply?
        • Workdrive on Android - Gallery Photo Backups

          Hello, Is there any way of backing up the photos on my android phone directly to a specific folder on Workdrive? Assuming i have the workdrive app installed on the phone in question. Emma
        • Integración Books para cumplir la ley Crea y Crece y Ley Antifraude (VeriFactu)

          Hola: En principio, en julio de 2025, entra en vigor la ley Crea y Crece y Ley Antifraude (VeriFactu). ¿Sabéis si Zoho va a cumplir con la ley para cumplir con la facturación electrónica conectada a Hacienda? Gracias
        • YouTube Live #1: AI-powered agreement management with Zia and Zoho Sign

          Hi there! We're excited to announce Zoho Sign’s first YouTube live series, where you can catch the latest updates and interact with our Zoho Sign experts, pose questions, and discover lesser-known features. We're starting off by riding the AI wave in
        • How to add a % Growth column for year-over-year comparison (2024 vs 2025)

          Hello, I am trying to build a monthly revenue comparison between 2024 and 2025 in Zoho CRM Analytics. My current setup is: Module: Deals (Affaires) Filter: Stage = Closed Won Date field: Closing Date Grouping: By Month Metrics: Sum of Amount for 2024,
        • How to searchByCriteria records that are under approval?

          I need to search for both approved and pending approval records Is that possible with this method? Or I need to a different method? var priceReqID = $Page.record_id; log(priceReqID); var records = ZDK.Apps.CRM.Price_List_Item.searchByCriteria("Price_Request:equals:"
        • Power of Automation::Streamline log hours to work hours upon task completion.

          Hello Everyone, A Custom Function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as to when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
        • How to add Simple Analytics to Zoho Pages?

          I have a website with Zoho Pages, how do I add Simple Analytics on it? They seem to have code they need to be embedded https://docs.simpleanalytics.com/script
        • End Date in Zoho Bookings

          When I give my appointments a 30 minutes time I would expect the software not to even show the End Time.  But it actually makes the user pick an End Time.  Did I just miss a setting?  
        • Cant seem to delete an email account

          Hello, I have researching for 4 days how to delete an email account and I am absolutely without a clue. The email account I am trying to delete is support<AT>fyshoes<dot>com. It's the first email account I made and it (is???) was associated with the super user (me). I have since changed it to adming<AT>fychoes<dot>com and I see the support email in my list but I just cant seem to get rid of it. Ultimately I want to associate that email account with another user that I want to add. This is really
        • Commerce Order as Invoice instead of Sales Order?

          I need a purchase made on my Commerce Site to result in an Invoice for services instead of a Sales Order that will be pushed to Books. My customers don't pay until I after I add some details to their transaction. Can I change the settings to make this
        • Import data into Multi-Select lookup field from CSV/Excel

          How to import data into a multi-select lookup field from the CSV/Excel Sheet? Let's say I have an Accounts multi-select lookup field in the Deals module and I want to import the Deals with Accounts field. Steps:- 1. Create/edit a multi-select lookup field
        • Sync desktop folders instantly with WorkDrive TrueSync (Beta)

          Keeping your important files backed up and accessible has never been easier! With WorkDrive desktop app (TrueSync), you can now automatically sync specific desktop folders to WorkDrive Web, ensuring seamless, real-time updates across devices. Important:
        • Script that deletes a record?

          We're using WP Plugin "Integration for WooCommerce and Zoho Pro", and have created a couple of Feeds to send data to Zoho. We are trying to create Contact records, but only based upon condition. Tried to make it with small Deluge function and Workflow,
        • A formula that capitalises the first letter of each word

          Hi all, is there a zoho formula that can capitalise the first letter of each word in a string? INITCAP only capitalises the first letter of the first word.
        • Reverse payment on accidentally closed invoice.

          An invoice was closed accidentally with the full payment added. However, only partial payment was paid. How can I reopen the invoice and reverse this to update it to show partial payment?
        • Quotes in Commerce?

          In Zoho Ecommerce, I need to be able to generate quotes, negotiate with customers, and then generate invoices. Currently, I plan to integrate Zoho CRM to generate quotes. After negotiation and confirmation, I will push the details to Zoho Ecommerce to
        • Zoho Commerce - Mobile Application

          Does Zoho Commerce have a mobile application for customers to place an order?
        • Register user through Phone Number by Generating OTP

          In zoho commerce , I am developing website on online food store Inilialy the user get verification code to their email for registering there account for login. But I need to login using phone number by generating OTP automatically rather than verification
        • Custom Buttons for Mass Actions

          Hello everyone, We’ve just made Custom Buttons in Zoho Recruit even more powerful! You can now create Bulk Action Buttons that let you perform actions on multiple records at once, directly from the List View. What’s new? Until now, custom buttons were
        • Zoho Vault Passwords

          Is there a way to consume Zoho Vault Manager passwords using the API? Thanks in advance.
        • Is the ChatGPT Assistant integration capable of recognizing WhatsApp voice messages?

          I was wondering: if a visitor sends me a voice message on WhatsApp, would the assistant be able to transcribe it and reply to them?
        • Zoho Creator to Zoho CRM Images

          Right now, I am trying to setup a Notes form within Zoho Creator. This Notes will note the Note section under Accounts > Selected Account. Right now, I use Zoho Flow to push the notes and it works just fine, with text only. Images do not get sent (there
        • 【Zoho CRM】レポート機能のアップデート

          ユーザーの皆さま、こんにちは。コミュニティチームの藤澤です。 今回は「Zoho CRM アップデート情報」の中から、レポート機能のアップデートをご紹介します。 目次 1. レポートのエクスポート時のレコードIDの表示について 2. 通貨項目の表示について 3. レポートの削除の監査ログへの反映について 1. レポートのエクスポート時のレコードIDの表示について これまで、レポートをエクスポートするとファイルにレコードIDが必ず含まれていました。レコードIDが識別子として役立つ場合もありますが、実際には多くの企業で参照されることはありません。
        • Translation in zoho bookings

          We cant translate zoho booking emails. The general text we can change. But what about text like: ""Here a link to join the meeting online:"" and "Add to Zoho Calendar" and "Add to Google Calendar"? No professional business have mixed languages. Its looking
        • Is there any way to bill one client in different currencies on different invoices?

          I have some customers who have their currency set as USD and most of their billing is done in USD.   However, from time to time I have a need to bill them in my base currency GBP for some specific invoices, but there seems to be no way of doing this that I can see. The only workaround that I can see is to create two client records for the same client, one for USD billing and one for GBP billing, but this is not an ideal situation. Is it likely that the (hopefully!) soon to arrive multi-currency support
        • API name for all fields in Zoho Project (Standard or custom)

          Hi! I struggle to find easily all API name of all field in Zoho Project to build my API rest with other services. We can find them very fast in CRM but not in PRoject.   Could you share a function to get the list of all API Name of any field of an App
        • Next Page