Update CRM Variables with Additional Business Logic

Update CRM Variables with Additional Business Logic

Update CRM Variables with Additional Business Logic

ZOHO CRM Variables provide the ability to store static values that can be updated in one spot and used across multiple functions within a ZOHO deployment.

Specific Events, Actions or responses to another function call can create a requirement to iterate or update these static CRM Variables and it would be much nicer to handle this programatically with a Standalone Function.

EDIT : Specific Events, Actions or Responses to another function call can create a requirement to update or iterate these static CRM VariablesRather than simply using the invokeConnector Deluge task which is a wrapper function for the invokeurl API call, it would be nice to run our own business logic with the update and handle this within a wrapper function like invokeConnector that we can define and call with minimal inputs across our deployment, this is achieved with a Standalone Function.

NOTE: Additional features are not covered under this Discussion.

Prerequisites

Connection

Using the invokeurl webhook method requires a Connection within your ZOHO deployment to make an API call to the CRM Variables endpoint. If you do not already have one setup, follow the ZOHO Developer docs here -> zoho.com/crm/developer/docs/connectors/set-up.html

Or alternatively, you can use the invokeConnection task, both methods are shown below.

CRM Variable

This example uses the id of an existing CRM Variable within your ZOHO CRM deployment. If you do not already have a CRM Variable setup, we'll do that now. If you do, copy the id and save that for a later step.

To create a CRM Variable go to Setup -> Developer Space -> ZOHO CRM Variables -> Create New Variable

  • Variable Name = test_variable
  • API Name = test_variable
  • Description = This is a test variable.
  • Variable Type = Single Line (For future reference this should macth the data type of the variable required)
  • Value = "MY TEST VARIABLE"
  • Grouped Under -> Create New Group
    • Group Name = test group
    • Group API Name = test_group
    • Description = This is a test group.
    • Click Save
  • Click Save
  • Click the Pencil Edit Icon to the left of the Variable Name
  • Copy the Variable ID from your web browser address bar, we'll need this later.

Create the Standalone function

We will now create the Standalone Function which can be called from any other function or WorkFlow.

Setting Up Standalone Function

To setup the standalone function:

  1. Go to Setup -> Functions -> New Function
  2. Name the function "update_crm_variable" and under Category select  Standalone. Click  Next.
  3. You'll be taken to the Deluge code editor.
  4. Edit your standalone function as below to use an API call :

    1. /* RUN SOME BUSINESS LOGIC HERE */
    2. // PASS VALUES FROM BUSINESS LOGIC INTO MAP
    3. /* update_crm_variable */
    4. variable_map = Map();
    5. variable_map.put("id",variable_id);
    6. variable_map.put("value",variable_value);
    7. variable_list = List();
    8. variable_list.add(variable_map);
    9. param = Map();
    10. param.put("variables",variable_list);
    11. update_variable = invokeurl
    12. [
    13.     url : "https://www.zohoapis.com/crm/v2/settings/variables"
    14.     type :PUT
    15.     parameters:param.toString()
    16.     connection: "YOUR_CONNECTION_NAME"
    17. ];
    18. /* RUN SOME OTHER BUSINESS LOGIC HERE */
    19. // TAKE RESPONSE FROM INVOKEURL
    20. //info update_variable;
    21. return update_variable;

    Or edit your standalone function as below to use the invokeConnector :

    1. /* update_crm_variable */
    2. variable_map = Map();
    3. variable_map.put("apiname","test_variable");
    4. variable_map.put("value",variable_value);
    5. variable_map.put("crm.set",variable_map);

  5. Click Edit Arguments and add the following two Function Arguments

    1. variable_id as type String
    2. variable_value as type String
    3. Click  Save

  6. Click  Save.

We can now move on to the requesting function.

Setting Up A Requesting Function

To setup a requesting function:

  1. Go to  Setup -> Functions -> New Function
  2. Name the function and select any Category. Click  Next.
  3. You'll be taken to the Deluge code editor.
  4. Edit your standalone function as below :

    1. /* REQUESTING FUNCTION */
    2. id = "YOUR_VARIABLE_ID_FROM_THE_PREVIOUS_STEP";
    3. value = "MY UPDATED VARIABLE";
    4. response = standalone.update_crm_variable(variable_id,variable_value);
    5. info "Response : " + response;

  5. Click  Save & Execute.

When you execute this requesting function, you should see the response printed in the console:

  1. /* CONSOLE */
  2. Info
  3. {"variables":[{"code":"SUCCESS","details":{"id":"YOUR_VARIABLE_ID_FROM_THE_PREVIOUS_STEP"},"message":"variable updated","status":"success"}]}
  4. Function executed successfully.

Check Your Updated Variable

To check this has worked:

  • Go to Setup -> Developer Space -> ZOHO CRM Variables

  • Check your variable value has changed to "MY UPDATED VARIABLE"

Using this method you can now automate updates on ZOHO CRM Variables.

EDIT : Why not just use invokeConnector?

The entire ZOHO ecosystem is API driven and clearly the invokeConnector deluge task does the same/similar thing under the hood as the invokeurl webhook. invokeConnector can also be used within the Standalone function to do the update, which method you use is really irrelevant to the outcome as they are functionally the same.

However, if you are applying the method in this Discussion to other use cases the invokeConnector is limited to existing predefined Associated Connectors or building your own ZOHO CRM Vertical Solution which adds its own inherent complexity.

If you want to do more than just update one record or you have specific dependent business logic you need to reuse across your ZOHO deployment, but want a reusable function, a Standalone function can provide the same simple features of the invokeConnector, with the added flexibility of computing additional business logic with flexible and definable inputs from the requesting function.


    Access your files securely from anywhere



                          Zoho Developer Community




                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts





                                                            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

                                                                                                            • Workdrive Android - how can I open a file in its native app?

                                                                                                              Hi, I'm testing Workdrive as a replacement for Onedrive. On a laptop/Windows this works fine. It syncs between devices and when I open a file, it opens the file in its native app. However, the Workdrive Android app seems to work differently. On a Android
                                                                                                            • Zoho SDK versioning and repositories need permanent naming/versioning changes moving forward

                                                                                                              I spent all day on this, a simple problem. Add a note to a lead, retrieve the notes from the lead. Finding samples and documentation is VERY difficult BECAUSE the versioning is totally non-standard. The php SDK doesn't follow SemVer. I suppose it may
                                                                                                            • Call transcrition working for ringcentral?

                                                                                                              I don't see anything about what telephony providers can be used. The Zoho support person A said that RingCentral isn't supported. Zoho support person B said that it works, just make sure the call recording link works. Excellent instructions here: Call
                                                                                                            • Filter by technical IDs that should not be displayed

                                                                                                              Hello Zoho and Cumminity. I know I have already found similar requests elsewhere, but have not yet received a solution from Zoho. Therefore I would like to refresh the topic and hope that a solution can be found. I have reports in the Creator, which I
                                                                                                            • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                                                                                              so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                                                                                            • is Zoho desk down ?

                                                                                                              We have not received any tickets via email on the Zoho desk for the past hour. I also tried sending several test emails, but as of right now, no new ticket has been created on the desk.
                                                                                                            • How to get the call recording external ID via desk API

                                                                                                              I have enabled phonbridge integration with Zoom Call. I am trying to access the call recording in Zoom by calling Zoom API. I have built a Desk workflow to trigger on a new call, to call a custom function. when calling the API, the response doesn't contain
                                                                                                            • A few Issues when using "Pay Bill via Check"

                                                                                                              We have quite a bit of issues with how paying for Bills via Check works. Would love some feedback from the Zoho team in case we are doing something incorrectly. 1. When we go from a vendor and select "Pay Bill via Check" option, we see ALL the outstanding
                                                                                                            • Books Not Matching Transactions from Feed - "The total amount does not match with that of the transaction"

                                                                                                              Recently, transactions that are transfers from a foreign currency (FCY) account to a base currency (BCY) account are not allowing for matches with transactions from the bank feed. Please see the screenshots below: As one can see, the amount is in the
                                                                                                            • Ability to Initiate WhatsApp Template Messages in Zoho SalesIQ Without Preexisting Chat

                                                                                                              Hi Zoho SalesIQ Team, I hope you're doing well. I understand that with the WhatsApp integration in SalesIQ, clients can contact us via WhatsApp, and we can use WhatsApp templates to send messages outside of the 24-hour window by reopening an existing
                                                                                                            • How to make one code flow run for multiple people in the org

                                                                                                              Hi Folks, I have built a flow to transfer a Zoho calender event as Zoho CRM module record. The code works perfectly as needed. But the issue is I want the same functionality for others in our org. It is showing only my calendar in the selection trigger.
                                                                                                            • For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account.

                                                                                                              Hello Zoho Even if we open 10-15 windows in still we are getting our accounts locked with error " For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account. "
                                                                                                            • Subject: Urgent: Unrelated Email Automation Issue – Request for Immediate Resolution

                                                                                                              Dear Zoho One Support Team, We are currently facing a critical issue with email automation in our Zoho One account. Despite deleting the associated templates and workflows, the same email templates are still being sent to our customers. This has become
                                                                                                            • Zoho Sites

                                                                                                              Does anyone have experience building Zoho sites or know how I can find someone who does?
                                                                                                            • Tip of the week 63- Know your contacts well with polls in Zoho Campaigns

                                                                                                              Communication in its true form is characterised by feedback. In email campaigns there are a few avenues via which you can achieve this. Using polls in Zoho Campaigns is one such way. With polls enabled in campaigns, your contacts can interact with your emails and help you understand them well.     There are three types of polls available to be enabled in your email campaigns:   Basic poll Rating based poll Reaction based poll     Basic poll-    Provide a question and allow the email recipients to
                                                                                                            • CRM->INVENTORY, sync products as composite items

                                                                                                              We have a product team working in the CRM, as it’s more convenient than using Books or Inventory—especially with features like Blueprints being available. Once a product reaches a certain stage, it needs to become visible in Inventory. To achieve this,
                                                                                                            • Relocating from Zoho Connect External to Zoho Connect Internal or Zoho CommunitySpaces... or move off of Connect completely.

                                                                                                              This conversation is aimed at Zoho clients that currently use Zoho Connect's External network platform. As I discovered in the comment section of another post, Zoho Connect is halting development of Zoho Connect EXTERNAL networks in favor of the new Zoho
                                                                                                            • Limited review (/questions) for Bookings 2.0

                                                                                                              Hi all, I'm writing this review of Bookings 2.0 for two reasons: 1) it may be of interest to others, and 2) I'd like to be corrected if I'm wrong on any points. It's a very limited review, i.e. the things that have stood out as relevant, and particularly
                                                                                                            • Recurring Events Not Disappearing from Zoho Calendar When Canceled by Organizer

                                                                                                              I receive a recurring meeting invitation to my Gmail address, The event correctly appears in my Zoho Calendar, since I have Gmail calendar integrated/viewable via Zoho Mail. When the organizer cancels one occurrence, the canceled meeting does not disappear
                                                                                                            • Create Funnel to Track Email Outreach Conversion

                                                                                                              Hello, We would like to create a funnel that measures: N° of emails sent -> N° of emails opened -> N° of emails responded We would like to measure this email response conversion rate for each of our SDRs. We use the analytics tool of Zoho CRM and not
                                                                                                            • Relay Mail Failed

                                                                                                              Hello, We are using SMTP Relay Settings in ZOHO CRM for sending emails using office 365 server. But every time we are receiving below errors. The Relay Configuration for the domain Domain.com and feature WorkFlow has failed 3 times today . Mails will
                                                                                                            • Can't lock timezone in new Zoho Bookings

                                                                                                              Hi, since the new Zoho Bookings has been changed, I cannot seem to lock the timezone in for the meetings. I have set the working hours and location, but when I got on the link, it automatically gives me slots in my timezone. I want to lock it for an in-person
                                                                                                            • Leverage layout rules to customize workflow

                                                                                                              Layout rules in Zoho Sprints primarily aim to customize the field layout of your creation forms to meet complex requirements. But it doesn't stop there. Its customization can push the boundaries of how your fields behave, how data is gathered, how processes
                                                                                                            • Auto-Generate & Update Asset Serial Numbers using a custom function (Assets Module)

                                                                                                              Hello Team, I’ve been working on a script to automate one of our processes in Zoho FSM, and the core functionality has been successfully implemented. However, I’m encountering an issue related to serial number allocation, which is not working as expected.
                                                                                                            • CRM Hack #3: How to update formula functions for already created records.

                                                                                                              Hello everyone! It’s Wednesday and we are back with yet another hack.. I'm sure you've used formula fields to meet some requirements specific to your business. Let's consider an example each for external (customer-facing) and internal facing scenarios
                                                                                                            • Leave request for 0 hours is registed as 24 hours

                                                                                                              I have configured workschedules for all my employees, so the leave request for them whould be a lot easier. In that spirit I have configured a shift from 9 to 9 with a total duration of 0 hours. When a employee fills in a leave request for lets say a
                                                                                                            • How can I see sent mail ?

                                                                                                              Hi, When you send a sale order or invoice to the customer using the email function, where can bee seen the sent email ? I can't find it in the "sent" folder of my mail client, nor I can't find it in the mail Related list under the company or the contact.
                                                                                                            • Add RTL (Right-to-Left) Text Direction Support Across All Zoho Learn Editing Interfaces

                                                                                                              Hi Zoho Learn Team, Hope you're doing well. We would like to request an important enhancement to Zoho Learn regarding support for right-to-left (RTL) languages such as Hebrew and Arabic. 🔹 Current Issue While the Knowledge Base Article editor provides
                                                                                                            • Nimble enhancements to WhatsApp for Business integration in Zoho CRM: Enjoy context and clarity in business messaging

                                                                                                              Dear Customers, We hope you're well! WhatsApp for business is a renowned business messaging platform that takes your business closer to your customers; it gives your business the power of personalized outreach. Using the WhatsApp for Business integration
                                                                                                            • Formula Fields inside of Blueprint Transitions

                                                                                                              We would like to have formula fields inside of blueprint transitions. We type in currency fields and would like to see the result inside of a formula field. Our use case: Send out a price for XY 1. Filling out cost fields 2. See gross profit
                                                                                                            • Zoho Creator Populate radio field with values with all the created rows subfor

                                                                                                              I have Main Form where i have a lookup field where i get brewery names and the number of tanks as a multiline text field with a list of beer names Based Brewery selected and bbt_tanks number i create rows in the subform and now i want to populate list
                                                                                                            • Recording Credit Card Fees when Recording Payment for Bills

                                                                                                              It seems I am unable to record credit card fees when paying a bill. I pay close to 100% of my bills with a company credit card via online portals. I'm happy for the CC fess to be recorded as Bank Charges but it will not allow that field to be used if
                                                                                                            • Search function in Zoho Sheet mobil app on android - not working

                                                                                                              Hello, Im new here and registered for Zoho Sheet. Than i installed the android mobile app on my tablet (redmi note pro 5g). But I cant use the search function for my added excel table. When I use the web version for zoho sheet with the same imported table
                                                                                                            • Error AS101 when adding new email alias

                                                                                                              Hi, I am trying to add apple@(mydomain).com The error AS101 is shown while I try to add the alias.
                                                                                                            • Zoho Books | Product Updates | April 2025

                                                                                                              Hello partners, We’ve rolled out new features and enhancements to elevate your accounting experience. From FEC report to BillPay Add-on, these updates are designed to help you stay on top of your finances with ease. Export Transactions in Factur-X Format
                                                                                                            • How to control the # of version of files to keep?

                                                                                                              Currently most of the WorkDrive Storage comprise of the many versions of files saved. How do I save some space and reduce the number of version of date or files saved in WorkDrive? Thanks
                                                                                                            • Creating Layout Rule With Formula Field

                                                                                                              By The Grace Of G-D. Hi, I see that i cannot use Layout Rules to show/hide Formula Fields. Is that something you plan on adding sometime soon?
                                                                                                            • Rich-text fields in Zoho CRM

                                                                                                              Hello everyone, We're thrilled to announce an important enhancement that will significantly enhance the readability and formatting capabilities of your information: rich text options for multi-line fields. With this update, you can now enjoy a more versatile
                                                                                                            • Meet Zoho Sign's AI answer bot!

                                                                                                              Hi partners, Our goal has always been to ensure all our resources are readily available for our users. With this in mind, we're excited to introduce Zoho Sign's answer bot, a solution designed to help users instantly find relevant help articles by eliminating
                                                                                                            • Widget JS SDK to Upload a photo to a record in a Module

                                                                                                              Good day,  I would really appreciate it if someone can assist me. I have written a widget, to be used in a Custom Module in CRM.  My goal: I want to upload a photo from my computer and display it in die "upload image" field. I am using the JS SDK: https://help.zwidgets.com/help/v1.1/index.html
                                                                                                            • Next Page