Building Extensions #13: Creating widgets with the JS SDK bundle in Zoho Desk - Resources API

Building Extensions #13: Creating widgets with the JS SDK bundle in Zoho Desk - Resources API

This series aims to equip developers with all they need to build extensions for Zoho Desk in Zoho Sigma and publish them in Zoho Marketplace.

The Zoho Desk platform supports custom fields. The custom fields can be introduced using an extension. The Zoho Desk platform supports this capability through resources.json found in the plugin-manifest file and the Resources API offered in the JS SDK bundle.
 
In this forum post, we'll explore the Resources API in detail with an example of creating custom fields. Other resource types offered by the Zoho Desk platform include webhooks, custom permissions, and channel connectors; we'll talk about these individually in our upcoming forum posts.

Need for custom fields 

There are various scenarios that may call for custom fields. Without creating an exhaustive live, here are a few scenarios in which you may need custom fields in Zoho Desk:
  • You might have to accommodate data from integrated third-party applications inside Zoho Desk. In such cases, you can add custom fields to help with this.
  • Your extension functionality may require some new fields to be available in the Zoho Desk modules. E.g., a few additional fields in your Tickets or Customers modules. In such scenarios, you would add a custom field to the desk modules.
  • You may want to provide agents with some additional information about the customer in the ticket's property section. You can add custom fields and pre-populate them with the relevant information.

Defining custom fields 

The custom fields are to be included in Zoho Desk by defining them in the resources.json of the plugin-manifest file. Below is the structure of the resources.json with sample data filled in.
      ...
      {
          "fields": [{
              "resourceName": "field1",
              "module": "tickets",
              "displayLabel": "Counter",
              "type": "Text",
              "defaultValue" : "none",
              "maxLength": "100"
          }]
      },
      ...
 
Every field you create should have a unique identifier that is defined using the mandatory resourceName key. The resourceName(s) specified in resources.json should be unique across the extension and will be validated before the extension is made available on the Zoho Marketplace. The resourceName also serves as the unique identifier across all organizations that install your extension. The new custom fields will be automatically mapped to the default layout configured for a department, so there is no need to pass the layoutId key anywhere else in the extension code.

Any field you include in your extension will be added to the user's Zoho Desk portal on the very first installation of the extension, while subsequent installations map to the fields already created. The fields are deleted from the portal on the last uninstallation of the extension. You can include a maximum of 10 custom fields in an extension.

Using custom fields in extensions 

The resourceName defined in the resources.json file is automatically mapped with an ID and an apiName, which can be used in the APIs related to the resource as required. You need to retrieve the ID and/or the apiName of a resource to be used in the API calls of your extension.
 
To retrieve this, you can use one of the following approaches:
  • Using merge fields in the invoke API
  • Using the client SDK

 Using the merge fields 

This method is applicable for Desk's invoke API where you need to specify the resourceName value in the following format.
 
      {{resourceType.resourceName.id}} or {{resourceType.resourceName.apiName}}
 
Refer to specifying placeholders in invoke API for more information.

Note: The resourceType should be fields or webhook, based on your use case. The id returns the fieldId or webhookId, based on the value in resourceType. The apiName returns the apiName of the resource and is applicable only to fields.

Using the client SDK 

In this method, you must use the Resource API to retrieve resource details.
 
Note: We will use the second approach in this forum post example; the first approach will be covered when we discuss Desk Invoke APIs.

Resource API   

The resource details of the extension can be obtained using this API provided the resourceName key is given in the resources.json file.

Note: The response will be given against the resourceName given in the extension.
 
Sample Request: Get the details of the resource "field1"
 
      ZOHODESK.get("extension.resource", {resourceName: "field1", resourceType:       "fields"}).then(function(response){
                //response returns the value saved
      }).catch(function(err){
                //error handling
      })
 
Response:
      {
          "status": "success",
          "extension.resource": {
          "resourceName": "field1",
          "id": "4000000020060",
          "resourceType": "fields",
          "apiName": "cf_counter"
          }
      }

Scenario:

Let's say you plan to provide support agents with some additional information about the users in the tickets' details page. Specifically, you need to display whether the user is a new user or an existing user. If the user is an existing user, you also want to note how many tickets are associated with that user and the number of open tickets. This can be implemented by adding the required custom fields and writing a script that provides details about the user and the tickets associated with them.

Defining fields in resources.json 

As per our use case, you can define two fields with the following properties:
 
Sl.No
Field name
Type
1
User type
Text
2
Number of open tickets
Text
 
Below is the resource.json file that needs to be defined. As mentioned earlier, the resourceName key for every field needs to be unique and has to be defined for every field.
      
      {"fields": [
          {
            "module": "tickets",
            "displayLabel": "User Type",
            "type": "Text",
            "defaultValue" : "none",
            "resourceName": "UserType",
            "maxLength": 100
          },
          {
            "module": "tickets",
            "displayLabel": "Number of open tickets",
            "type": "Text",
            "defaultValue" : "none",
            "resourceName": "openStatus",
            "maxLength": 100
          }
        ]
      }
 
Note: You'll need the API names of the resources in your implementation whenever you refer to the respective resource. The Resources API can be used to fetch the API names. The code below has been used for fetching the API names for the two fields in our use case and the same API names are used in the code. The console output is added for reference.

      ZOHODESK.get("extension.resource", {resourceName: "UserType", resourceType:       "fields"}).then(function(response){
      console.log(response);
      }).catch(function(err){
      console.log(err);
      })

      ZOHODESK.get("extension.resource", {resourceName: "openStatus", resourceType:       "fields"}).then(function(response){
       console.log(response);
      }).catch(function(err){
      console.log(err);
      })


Use case implementation 

To implement our use case, we perform the following steps in extension.onload. The code snippet is added below for reference:
  • Get the email ID of the current ticket.
  • Use the Zoho Desk search API to check if there are any other tickets from the same user.
  • If the search API results show more tickets from the same email, check the status of those tickets.
  • Finally, construct the result so it is set to the custom fields and update them accordingly.

Sample code: 

      Please check the attachments for the sample code.

Output:




 
Here, you can see the text for the two custom fields were added to the ticket and were populated with the relevant values. In this manner, you can add required custom fields to Zoho Desk using extensions, based on your business needs.
 
Hope you found this post to be useful. Stay tuned for more posts in this space!

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner






                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner






                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • How to list emails in a folder, e.g. Inbox, on multiple pages when using Zoho mail webpage?

                                                                                                              Something as shown in the figure. There are totally 50 emails in Sent folder. If "Mail per page" equals 20, then the Sent folder is split into 3 pages. When I wander through Sent folder, I can just select a specific page to jump to. BTW, it seems that
                                                                                                            • Unable to Create Zoho Booking via the Book Appointment API

                                                                                                              Its giving the below error {     "response": {         "errormessage": "Error setting value for the variable:customer_details\n null",         "status": "Error"     } } Request: POST Url: https://www.zohoapis.in/bookings/v1/json/appointment attached Zoho-oauthtoken
                                                                                                            • SHEET - Send email when a cell changes

                                                                                                              I would like to create a custom function for Zoho Sheet that triggers when a paticular cell changes to a specific value. This would result in sending an email to a recipient (this would be an address that remains the same and included in the script). Example: = IF(N4= "Drafted", <>EmailFunction) 1)     Cell N4 changes to "Drafted" 2)    Email is sent to recipient            or alternatively 3)    Post to chat channel I have found the Custom function editor in Sheet. I am not bad at scripting, but
                                                                                                            • 【開催報告】 福岡 ユーザー交流会 2025/8/8(金)

                                                                                                              皆さま、こんにちは。コミュニティチームの中野です。 8/8(金)に、福岡 ユーザー交流会を開催しました。 本投稿では、その様子をお届けします。当日の登壇資料などもこちらに共有しますので、参加できなかった皆さまもご参照ください。 今年初の開催となる福岡 ユーザー交流会では、CreativeStudio樂合同会社 前田さんによるZoho CRM / Sign / Survey の事例セッションのほか、 Zoho社員セッションでは、Zoho Forms の活用法を解説。 さらに、「見込み客・顧客データの管理/活用方法」をテーマに参加者同士でZoho
                                                                                                            • no me llegan los correos a Zoho mail

                                                                                                              No puedo recibir correos pero sí enviarlos, ya hice la modificación de MX y la verificación de teléfonos, qué es lo que ocurre? gracias
                                                                                                            • Error: Invalid login: 535 Authentication Failed

                                                                                                              I have used zoho with nodemailer. const transporter = nodemailer.createTransport({ host: 'smtp.zoho.com', port: 465, secure: true, auth: { user: 'example@example.com', pass: 'password' } }); While sending the mail, it shows the following error: Error:
                                                                                                            • Zoho Renewal

                                                                                                              Hello, If I am not going for zoho email renewal. will i get back my free zoho account? and if yes then is it possible to get back my all free user. how many user get back 10 or 25?
                                                                                                            • javax.mail.authenticationfailedexception 535 authentication failed

                                                                                                              Hi, I am facing 535 authentication failed error when trying to send email from zoho desktop as well as in webmail. Can you suggest to fix this issue,. Regards, Rekha
                                                                                                            • Not reciving emails

                                                                                                              Apparently i cannot recive emails on my adress contact@sportperformance.ro I can send, but do not recive. The mail i'm trying to send from mybother adress gets sent and doesn't bounce back... but still doesn't get in my inbox. Please advise
                                                                                                            • Not receiving MailChimp verification e-mail

                                                                                                              It seems that their verification e-mails are blocked. I can receive their other e-mails, but not their verification of domain ownership e-mail. I've checked and double checked how I typed the e-mail, using different e-mails (my personal e-mail can receive it), white listing the domain and all that is left is for the IP's to be white listed, but I don't have that power.  If a staff member could take a look at this -> http://mailchimp.com/about/ips/ And perhaps white list them for me, that would be
                                                                                                            • Creating my 2nd email account

                                                                                                              After creating my first email address, I decided to get another email address. I would like to use this new address as the primary address too. I don't know how to set it up there doesn't seem to be an option for that
                                                                                                            • Cannot - create more email account - Unusual activity detected from this IP. Please try again after some time

                                                                                                              Hello, I come across the error message in Control Panel. Unusual activity detected from this IP. Please try again after some time and i cannot create any more users We are an IT company and we provide service for another company Please unlock us.
                                                                                                            • "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain"

                                                                                                              Good day. When I try to send mail through ZOHO mail I get the following error : "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain" I need help with this. My zohomail is : @eclipseweb.site Thank you,
                                                                                                            • Transfert de domaine pour création des comptes emails

                                                                                                              Bonjour , je ne parviens point à créer des mails avec le domaine 'raeses.org' suite à la souscription du domaine auprès d'un autre hébergeur, dont j'ai fait la demande du code de transfert qui est le suivant : J2[U8-l0]p8[ En somme, attente de l'activation
                                                                                                            • Help! Unable to send message;Reason:554 5.1.8 Email Outgoing Blocked.

                                                                                                              Kindly help me resolved this issue that i am facing here.
                                                                                                            • How are people handling estimates with Zoho inventory?

                                                                                                              We are often using Zoho Books for estimates that then get converted to invoices within Books. We would like the sales team to migrate entirely to Zoho Inventory and no longer need to use Zoho Books so that they are only on one system. How are people managing
                                                                                                            • Relative Date Searches

                                                                                                              Currently in the search options, it has "date", "from date" and "to date". I think it would be great if there were options like "date greater than x days ago" and "date less than x days ago". I realise that as a once off you can just use the existing
                                                                                                            • Performance is degrading

                                                                                                              We have used Mail and Cliq for about three years now. I used to use both on the browser. Both have, over the past 6 months, had a severe degradation in performance. I switched to desktop email, which appeared to improve things somewhat, although initial
                                                                                                            • Ask the Experts 23: Customize, utilize, and personalize with Zoho Desk

                                                                                                              Hello everyone! It's time for the next round of Ask the Experts (ATE). This month is all about giving Zoho Desk a complete makeover and making it truly yours. Rebrand Zoho Desk with your organization’s details, customize ticket settings based on your
                                                                                                            • Dear Zoho CEO: Business Growth is about how you prioritise!

                                                                                                              All of us in business know that when you get your priorities right, your business grows. Zoho CRM and Zoho Books are excellent products, but sadly, Zoho Inventory continues to lag behind. Just this morning, I received yet another one-sided email about
                                                                                                            • Payroll In Canada

                                                                                                              Hi, When can we expect to have payroll in Canada with books 
                                                                                                            • Please review and re-enable outgoing emails for my domain

                                                                                                              Hello Zoho Support, I have recently purchased a new domain and set up email hosting with Zoho. However, my account shows "Outgoing Email Blocked". I am a genuine user and not sending bulk/spam emails. Please review and re-enable outgoing emails for my
                                                                                                            • Payroll without tax integrations (i.e. payroll for international)

                                                                                                              It seems as though Zoho waits to develop integrations with local tax authorities before offering Zoho Payroll to Zoho customers in a country. Please reconsider this approach. We are happy Zoho Books customers, but unhappy that we have to run payroll in
                                                                                                            • goingout e mail block

                                                                                                              info@ozanrade.com.tr
                                                                                                            • Incoming mails blocked

                                                                                                              Zoho User ID : 60005368884 My mail Id is marketing#axisformingtechnology.com .I am getting following message "Your Incoming has been blocked and the emails will not be fetched in your Zoho account and POP Accounts. Click here to get unblocked." Please
                                                                                                            • Assistance Needed: Ticket Status Not Updating and Sorting by Last Customer Reply in Zoho Desk

                                                                                                              Hello, I’m facing two issues in Zoho Desk that I’d like your guidance on: Ticket Status Not Updating: When a customer replies to a ticket, the status does not change to Reopened. Instead, it remains in Waiting on Customer, even after the customer’s response
                                                                                                            • Configuring Email Notifications with Tautulli for Plex

                                                                                                              Hi I'm new to Zoho. I am from Canada and I have a I use a web based application called Tautulli for Plex that monitors my Plex media server. It also sends a newsletter to my followers. To set this up they require a "From" email address., a smtp server
                                                                                                            • Is there a way to automatically add Secondary Contacts (CCs) when creating a new ticket for specific customers?

                                                                                                              Some of our customers want multiple contacts to receive all notifications from our support team. Is there a way to automatically add secondary contacts to a ticket when our support team opens a new ticket and associates it with an account? This would
                                                                                                            • How to Set Up Zoho Mail Without Cloudflare on My Website

                                                                                                              I'm having some trouble with Cloudflare here in Pakistan. I want to configure Zoho Mail for my domain, but I'm not sure how to set it up without going through Cloudflare. My website, https://getcrunchyrollapk.com/ , is currently using CF, but I'd like
                                                                                                            • Spam is Being Forwarded

                                                                                                              I am filtering a certain sender directly to the Trash folder. Those messages are still being forwarded. Is this supposed to happen?
                                                                                                            • IMAP Block

                                                                                                              My two accounts have been blocked and I am not able to unblocked them myself. Please respond to email, I am traveling and this is urgent.
                                                                                                            • "DKIM not configured"

                                                                                                              Hello. I have been attempting get the DKIM verified but Toolkit keeps sending the message that it is not configured, but both Namecheap and Zoho show it as configured properly. What am I missing?
                                                                                                            • Zoho mail with custom domain not receiving email

                                                                                                              i registered zoho mail with my own domain. I can login and access the mail app. I tried to send email from an outlook email account and an icloud email account. Both emails were not received. My plan is free. I also tried to send email from this zoho
                                                                                                            • Set connection link name from variable in invokeurl

                                                                                                              Hi, guys. How to set in parameter "connection" a variable, instead of a string. connectionLinkName = manager.get('connectionLinkName').toString(); response = invokeurl [ url :"https://www.googleapis.com/calendar/v3/freeBusy" type :POST parameters:requestParams.toString()
                                                                                                            • Waterfall Chart

                                                                                                              Hello, I would like to create a waterfall chart on Zoho analytics which shows the movement in changes of budget throughout a few months, on a weekly basis. Should look something like the picture below. Does anyone know how to?
                                                                                                            • Help Center and SEO: Any Benefit to My Domain-Mapped Website Ranking?

                                                                                                              First of, I love the Help Center which I've just decided to integrate into my website to replace its old-fashioned FAQs. So much more to achieve there now! Lots of new benefits to the site visitors and to me in terms of organizing and delivering all the
                                                                                                            • Issue with Importing Notes against Leads

                                                                                                              Hi, I am attempting to import some Notes into Zoho CRM which need to be assigned to various Leads. I have created a csv file which I am testing that contains just one record. This csv file contains the following columns: Note Id Parent Id       (I have
                                                                                                            • Trigger a Workflow Function if an Attachment (Related List) has been added

                                                                                                              Hello, I have a Case Module with a related list which is Attachment. I want to trigger a workflow if I added an attachment. I've seen some topics about this in zoho community that was posted few months ago and based on the answers, there is no trigger
                                                                                                            • Option to Hide Project Overview for Client Profiles

                                                                                                              In Zoho Projects, the Project Overview section is currently visible to client profiles by default. While user profiles already have the option to restrict or hide access to the project overview, the same flexibility isn’t available for client profiles.
                                                                                                            • Creator Add Records through API - Workflows not triggered ?

                                                                                                              Hi Everyone, I am trying to add records to my Creator application through a third party app that I am developing. Currently, I am testing this through Postman. The records I need to add have a lot of workflows to run to populate dropdowns, fields, use
                                                                                                            • Next Page