Extension Pointers #3: Learn to use Custom Variables while building extensions

Extension Pointers #3: Learn to use Custom Variables while building extensions

Looking for an option to store static information that can be accessed across an entire extension? The solution you're seeking is Custom Variables!

What are Custom Variables?

Custom variables store static information in your CRM. They are global variables that can be used in place of certain important fields in CRM to help users easily make personalized changes.

Consider a third-party integration scenario involving fields pertaining to personal data like a username, password, or authtoken. These values are user-specific and thus vary based on the user trying to access the application. So the developer will not be able to store or hard-code the value of these fields during the extension development process.

Custom Variables easily handle this situation by allowing the users to enter data from their end during the extension installation process. This data is then saved as the value for the field and provides a hassle-free experience.

Custom Variables for third-party integrations

Custom variables are of major importance in scenarios where data needs to be globally accessed across an entire extension, as well as during third-party integrations where security-related, user-specific data needs to be passed in order to establish a successful integration.

While most third-party applications today support the OAuth 2.0 authorization method for establishing an integration, there are few applications that support only API Key forms as an authorization method.

If the third-party application with which you wish to integrate supports API key forms, Custom Variables are the best option to establish an integration.

Note: To check out the integration process for applications using OAuth 2.0 authorization method, click here.

Methods involved while using custom variables

While using custom variables, there are situations where we might have to assign or pass the value of the custom variable across for performing logical functionalities or other tasks. In such cases we might need to either set or retrieve the value of custom variables accordingly. There are certain methods involved in manipulating the custom variable data—namely:
  1. Set Organization Variable
  2. Get Organization Variable
Set Organization Variable 

This is used to set the value of the custom variable.

Syntax:

<Response> = zoho.crm.invokeConnector("crm.set", <valueMap Map>);

where,
<Response> is the response details regarding the success or failure of updating.
<valueMap Map> is the map containing the key value pair denoting the API name of the custom variable to be updated, and the value with which the custom variable should be updated.

Get Organization Variable


This is used to fetch the value of the custom variable.

Syntax

<Response> = zoho.crm.getOrgVariable("<customVariableName>");

where,
<Response> returns the value of the custom variable.
<customVariableName> is the API name of the custom variable.

How to create a Custom Variable

1. Choose Custom Properties from the left panel of the Zoho Developer console under Build, and then click Create your first CRM variable.



2. Enter the necessary details and click Save. The value field is currently left empty for the users to later enter the value when prompted during the installation of the extension.



3. The custom variable is createdThe system also creates a unique API name for the custom variable in the following format "extensionNameSpace__VariableName"The system creates a unique API name by appending the extension name as a prefix. In our example, "API Key" is the custom variable created to hold the API key. "testcrm2__API_Keyis the unique API name provided by the system where "testcrm2" is the extension's unique namespace.



Similarly, let's create another custom variable to hold the user's email ID.



NoteYou can obtain the extension's NameSpace from the Extension Details page.





Establishing a connection with a third-party application (Datanyze)

The general flow involved around custom variables here is as follows:
  • While installing an extension, the user is prompted for values specific to authorization (set as custom variable in the extension) like username/password/API key.
  • The user enters the required value for the custom variable.
  • With the help of the data entered, the connection is established with the third-party application. 
For our example, let's take Datanyze as our third-party application. Datanyze mainly focuses on data enrichment through methodologies such as technographics and firmographics.

Note: The "API key" (also known as auth token) of Datanyze is required to complete the integration process. Log In or Sign Up with Datanyze to obtain a user-specific API key.

Let's write a custom function to see how the CRM tasks work and if the API call fetches us a response.



Code snippet:

valueMap = Map();


valueMap.put("apiname","testcrm2__API_Key");

valueMap.put("value","{API key token}");

resp = zoho.crm.invokeConnector("crm.set",valueMap);

info resp;

info "";

value = zoho.crm.getOrgVariable("testcrm2__API_Key");

info "The value of the custom variable, apikey, is " + value;

info "";

valueMap = Map();

valueMap.put("apiname","testcrm2__Email");

valueMap.put("value","{email id}");

resp = zoho.crm.invokeConnector("crm.set",valueMap);

info resp;

info "";

value2 = zoho.crm.getOrgVariable("testcrm2__Email");

info "The value of the custom variable, username, is " + value2;

info "";

response = invokeurl

[

url:"https://api.datanyze.com/industries/?

email={email}&token={API key token}"

type :GET

];

info response;

Here,

{email}
The Email ID associated with your Datanyze account.

{API key token} 
The API key generated by Datanyze for the corresponding {email}.

https://api.datanyze.com/industries/?email={email}&token={API key token}"
The Datanyze API call to get a list of all industries for data enrichment.


Click Execute to check the response.

The script returns
the status code as a response for the set organization variable method,
the value obtained as a response for the get variable method, and
a JSON response for the API call.

This indicates that locally the api key works fine and the response is fetched as expected.

When the extension is installed in a Zoho CRM account, the user is prompted for the API key and email.


Enter the API key and email. Click Save.

In our example, we've created two custom variables—testcrm2__Email and testcrm2__API_Key—for a user's Email ID and API key token, respectively, as required in the Datanyze API call to get a list of industries. Similarly, you can create any number of custom variables as needed.

You can also create and alter the function logic as needed to incorporate the data obtained from the Datanyze integration into your Zoho CRM.

We hope you found this content useful—keep following this space for more input!

SEE ALSO:





    Access your files securely from anywhere

        Zoho FSM Video Tutorials


              All-in-one knowledge management and training platform for your employees and customers.






                                    Zoho Developer Community




                                                          • Desk Community Learning Series


                                                          • Digest


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Glossary


                                                          • Desk Marketplace


                                                          • MVP Corner


                                                          • Word of the Day


                                                          • Ask the Experts



                                                                    • Sticky Posts

                                                                    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

                                                                      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
                                                                    • Kaizen #256 - Build an Arrival Readiness Web Tab in Zoho CRM

                                                                      Hi everyone! Welcome back to the Kaizen series! In the post, we discuss a use case in hospitality industry: how an Arrival Readiness web tab widget can be used to let reception staff identify and resolve issues before arrival of guests. Use case In the
                                                                    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

                                                                      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
                                                                    • Kaizen #226: Using ZRC in Client Script

                                                                      Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
                                                                    • Kaizen #222 - Client Script Support for Notes Related List

                                                                      Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how


                                                                    Manage your brands on social media



                                                                          Zoho TeamInbox Resources



                                                                              Zoho CRM Plus Resources

                                                                                Zoho Books Resources


                                                                                  Zoho Billing 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

                                                                                                      Get Started. Write Away!

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

                                                                                                        Zoho CRM コンテンツ




                                                                                                          Nederlandse Hulpbronnen


                                                                                                              ご検討中の方






                                                                                                                        • Recent Topics

                                                                                                                        • Bank Transaction Rules Link Under Each Bank Account

                                                                                                                          Hello, can you'll move the "transaction rules" button or link back under each bank account? It is now on Bank Overview, if I am working on a specific bank account, I don't want to go out to overview to check the rules. That button displays rules for all
                                                                                                                        • Nested notebooks

                                                                                                                          Dear Sir/Madam, I would like to know if it is possible to nest notebooks. It would be very helpful when there are too many, as it would improve organization. Thank you for your response. Best regards.
                                                                                                                        • Zia Agents looks promising, but I still cannot deploy my first agent or connect WhatsApp after weeks of support tickets

                                                                                                                          Hi Everyone, I am posting here because I am stuck and need practical help from someone who has successfully deployed a Zia Agent with WhatsApp. Zia Agents looks like a very promising product. I have watched the platform expand quickly, and I have noticed
                                                                                                                        • Zoho CRM

                                                                                                                          Cuándo voy a adjuntar un archivo .pdf en un registro en el campo Archivo obtengo el siguiente error:
                                                                                                                        • Implement Meeting Polls in Zoho Bookings

                                                                                                                          Dear Zoho Bookings Support Team, We'd like to propose a feature enhancement related to appointment scheduling within Zoho Bookings. Current Functionality: Zoho Bookings excels at streamlining individual appointment scheduling. Users can set availability
                                                                                                                        • Recording Salaries and wages in zoho books with bank fees

                                                                                                                          Hello Community, I am posting this questions to understand the best way to record the salary and payroll expenses in zoho books. The way it works here, For example if I have 3 employees and each employee salary is lets say $1000. I usually use the bank
                                                                                                                        • API - Available Stock Definitions

                                                                                                                          Okay, Zoho team... your copywriters fell down on the job for this one :) I think these warrant a bit more explanation as to what they include and what they don't.
                                                                                                                        • [BUG] WebTabs in ZohoCRM now have a spurious "\" displayed along with some additional HTML Head code included

                                                                                                                          An example of the issue can be seen below:
                                                                                                                        • CNIL - Suivi de Pixel

                                                                                                                          Bonjour à tous, À la suite de la nouvelle recommandation de la CNIL sur les pixels de suivi dans les e-mails, savez-vous si Zoho Campaigns permet : de conditionner le suivi des ouvertures au consentement de chaque contact ; de proposer un lien permettant
                                                                                                                        • Scheduled import

                                                                                                                          The tutorial shows a scheduled import option but this option doesn't appear to be available when using Zoho DB.
                                                                                                                        • #4 Choosing How My Invoice Should Look

                                                                                                                          Day 4: Meera had the basics sorted. Her business name was there, the address looked right, and her logo finally appeared where it should. But the invoice still did not quite look like hers. Her old studio used invoices that were clean, tightly laid out,
                                                                                                                        • Transaction rules for "Owner's Contribution" ?

                                                                                                                          I have a bank account where a lot of the deposits are "Owner's Contributions" (i.e., the business owner investing money in the company). Is it possible to create a Transaction Rule to automatically recognize these? They all have the same verbiage from
                                                                                                                        • DYK 12: Turn Email into Work Items

                                                                                                                          Did you know you can add work items to your Zoho Projects portal directly from your inbox? The initial step of important collaborations start over an email, and most of these require an immediate follow-up by creating a task, or reporting an issue. During
                                                                                                                        • Custom Function not getting package details when triggered from Workflow Rules.

                                                                                                                          I have a custom function for Packages that submits a form in our Creator app that we use to generate custom shipping labels (internal staff complete deliveries so we cannot generate shipping labels straight from Inventory). When the function is executed
                                                                                                                        • how to Solve Conflict Invoices in Zoho POS

                                                                                                                          Hello Team, I am facing a repeated issue in Zoho POS while saving a sale that contains service-based items. My products are intentionally created as Service (Non-Inventory) items because I do not want to track stock for them. However, every time I try
                                                                                                                        • ¿Cuándo estará disponible la edición de Zoho POS para México?

                                                                                                                          He estado revisando las capacidades de Zoho POS y su evolución dentro de la estrategia de Zoho for Retail, y me parece que existe una oportunidad muy interesante para el mercado mexicano. Zoho POS ya ofrece funcionalidades para gestionar ventas, inventario,
                                                                                                                        • Important update for Zoho RPA Windows Agent users

                                                                                                                          Hi everyone, We would like to share an important update for Zoho RPA Windows Agent users running Windows Server 2016 or Windows Server 2019. The new Zoho RPA Windows Agent 6.0.0 and later versions are not supported on Windows Server 2016 and Windows Server
                                                                                                                        • Multi-Option Estimates: One Estimate, Multiple Choices

                                                                                                                          Every service request can have multiple solutions. Multi-Option Estimates help you present these different solutions in a single estimate with its own name, parts, price, and total. Each option can differ in scope, approach, or price — whatever choices
                                                                                                                        • Marketing Tip #32: Improve SEO and customer confidence with an FAQ section

                                                                                                                          Before making a purchase, customers often have simple questions about delivery times, returns, product usage, or sizing. If they can’t quickly find answers, they may leave your store without buying. Adding a clear FAQ (Frequently Asked Questions) section
                                                                                                                        • ZOHO Campaigns in ZOHO Analytics - Campaigns vs Contacts Table

                                                                                                                          There seems to be information in the Zoho Campaigns table such as Unique Opens and Unique Clicks that can't be found in the Campaigns vs Contacts table where only Opens and Clicks are shown on a per contact level. Is there a way to bring Unique Opens
                                                                                                                        • How to change an employee mail id

                                                                                                                          Hi, Does the administrator have the rights to edit an  employees mail id. 
                                                                                                                        • Cousin Domain Verification in Zoho Mail: Identify and block look-alike domains

                                                                                                                          Phishing attacks often rely on domain names that closely resemble legitimate ones. This makes it difficult for users to identify fraudulent emails at first glance. Zoho Mail's Cousin Domain Verification feature allows administrators to define trusted
                                                                                                                        • How do I add 2 agents under the same email?

                                                                                                                          I have 2 agents who use the same email address. I added one, but when adding the second agent, it says that the email is already registered. How do I configure this properly?
                                                                                                                        • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

                                                                                                                          Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
                                                                                                                        • Updating an Invoice Line Item's Discount Account via API Call / Deluge Custom Function

                                                                                                                          I need help updating an invoice line item's discount account via API. Below is a screenshot of the line item field I am referring to. Now the field to the left of the highlighted field (discount account) is the sales income account. I am able to modify
                                                                                                                        • Associate project with timer on iPhone

                                                                                                                          When I start the timer without first associating a project (on my iPhone), its starts fine but now when I need to associate a project, and click on the link, I get a list of EVERY project I've ever put into Zoho Books. It used to just show active projects.
                                                                                                                        • Sales Tax Refund on Commerce Order

                                                                                                                          I've looked high and low. Relatively new to ZOHO but not to systems in general. How do we produce a refund for sales tax charged and paid for by a customer in error? This does not impact inventory stock. Simply for accounting and getting the $ back to
                                                                                                                        • Importing Chart of Accounts from Quickbooks -- "Debit or Credit"?

                                                                                                                          I'm trying to switch from QB to Zoho Books. I've prepped my chart of accounts and put it into the format following the structure of the sample CSV file. But one thing that does not exist at all on the Quickbooks side is the Zoho column for "Debit or Credit".
                                                                                                                        • Long term pricing for customers managing multiple organizations

                                                                                                                          I've been using Zoho extensively for quite some time and genuinely think it's one of the most powerful and customizable business platforms available. Between Zoho Books and Zoho Analytics, I've invested a significant amount of time building automations,
                                                                                                                        • Default Status for Appointments to Completed

                                                                                                                          We use Zoho Bookings integrated with Zoho Desk to book time for tech support sessions, we've configured it to only allow for a contact to book a single session to avoid customers overbooking time that may not be needed. The trouble is, once a session
                                                                                                                        • Customer User Fields for use in Rules

                                                                                                                          Hi, I would like to be able to add custom fields to the users, such as Department or Role, which can then be used in Rules, Reports, etc. as a condition. A use case is limiting Global lists or Choices based on the users Custom Field, so one form can be
                                                                                                                        • Add ZeptoMail to Zoho One

                                                                                                                          Hi Zoho Team, I would like to request that ZeptoMail be added as a fully included application within Zoho One. Why this is important Zoho One is positioned as a unified business operating system that brings the applications an organization needs under
                                                                                                                        • Item image on document

                                                                                                                          I know what I am asking may not be possible, but I will ask anyway, maybe I will get lucky, and someone else is doing it. My business is based on special orders only from various online stores. When I send a quote to a client, I generate a separate quote
                                                                                                                        • Dashboard Metric Drill-Down Shows Stale Data

                                                                                                                          Summary: When clicking between different metric components on a custom dashboard, the drill-down list shows data from the previously opened metric instead of the one just clicked. Steps to Reproduce: Create a custom dashboard with multiple pre-defined/templatized
                                                                                                                        • Allow Reauthorizing CRM Connections Without Revoking First

                                                                                                                          Currently, when a Zoho CRM connection needs to be reauthorized or authorized with another account, we first have to revoke the existing authorization and then authorize it again. This creates a gap where the connection is unavailable, and any functions,
                                                                                                                        • Programmatic Itemized Expenses?

                                                                                                                          It does not appear that it is possible to create itemized expenses programmatically (via the API)? Is this correct, or am I misunderstanding the situation?
                                                                                                                        • Zoho Marketing Automation Cannot Sync Lookiup Fields

                                                                                                                          Hello all, It seems that Zoho MA cannot sync Lookup fields from the CRM. Can you confirm if this is the case? Is there a workaround? Do you know if Campaigns can sync with custom modules and also with Lookup field in the CRM? Thank you!
                                                                                                                        • Specific ListView Canvas on Canvas Home Page Always Loads Most Recent ListView, Not the One Specified

                                                                                                                          I had mentioned this to ZOHO, but I mainly wanted to see if others in the Community are also facing this problem. I created a Canvas ListView for a Custom Module, and then created a Canvas Home page (technically on a tab item, but I'm not sure if that
                                                                                                                        • Zoho Campaigns EU Topics API returns HTTP 200 with empty topicDetails

                                                                                                                          Hello, Our Zoho Campaigns EU organisation has two custom topics visible in the Campaigns UI, and contacts are subscribed to them. However, an OAuth request with ZohoCampaigns.contact.READ to https://campaigns.zoho.eu/api/v1.1/topics returns HTTP 200 with
                                                                                                                        • Caso de Éxito: Cómo Toyota Financial Services unificó la atención al cliente con Zoho

                                                                                                                          "Después de seis meses con el CRM en producción estamos encantados." Miriam Cárdenas, Responsable Departamento ATC Toyota Financial Services es la división financiera de Toyota encargada de gestionar la financiación de vehículos y, junto con KINTO España,
                                                                                                                        • Next Page