Developing Third-party Integrations - Custom Variables

Developing Third-party Integrations - Custom Variables

The guide will help you with the following:
  1. Create a custom variable
    1. The Variable VariableMap
    2. Example
  2. Create a Read-only custom variable
  3. Create a Hidden custom variable

Custom variables are global variables that store information in your CRM. These allow you to replace certain key values - such as username or brand - in various elements of CRM, allowing customers to easily make system-wide changes and personalizations.

Custom variables can also be used to update important organization-specific integration data such as auth tokens, usernames, and passwords, enabling users to add or update their security information in a single step. The different types of organization variables provide ways to handle these data in the desired manner. For example, if account-specific values are in question which cannot be entered by the developer during the design process, then custom organization variables make it easy for the end user to enter this information themselves then populate it throughout the system automatically. This delivers a seamless integration experience and eliminates unnecessary system maintenance.

Create a custom variable

Characteristic Details
Value
Property in CRM
Read-write
Will changes made to its value from the Developer Console affect existing users?
No
Can its value be modified programmatically?
Yes

To set up a custom variable:
  1. Log in to Zoho Developer Console and click Sigma and select a workspace.
  2. Select the extension to modify and click the Edit Extension [] icon.
  3. Click Custom Properties in the left pane, then click Create.
  4. Provide the following details:
    1. A suitable Field Name.
    2. An API Name.
    3. Value for the variable.
      This is not mandatory, but you will be prompted to fill in a value when the extension is installed.
  5. Click Save.


Note The system will append an appropriate prefix to make it unique. For example: If the  Extension Name is  Leads ScoreField Name is  Authtoken, and  API Name is Authtoken, when the variable is saved, the API name will be set as  leadsscore__Authtoken.

The Variable VariableMap

The variableMap variable can be used only in the  Field Value - On change action to obtain the old and new values of a custom variable from Zoho CRM. Click the  Write Script in the  Field Value-On Change option to write the script.

The syntax for getting the old value of the custom variable is
  1. <oldvalue> = input.variableMap.get("oldvalue");

The syntax for getting the new value of the custom variable is

  1. <newvalue> = input.variableMap.get("newvalue");

The sample script to be written in the editor is

  1. oldzwsid = input.variableMap.get("oldvalue");
  2. newzwsid = input.variableMap.get("newvalue");


Example
Consider an extension that will integrate your Zoho CRM account with Zillow - an online real estate database company. This integration will help fetch details about properties in the lead's preference location and display in the 'Properties' module of the CRM automatically using a Zillow-specific ID called  zws-id, whenever a new lead is added into the solution. This zwid must be provided as a custom variable to facilitate this integration. This custom variable can then be invoked using a custom function to help us extract the data from Zillow and display it as related list.

To integrate Zillow with Zoho CRM
  1. Create an extension named Zillow.
  2. Create a custom variable with the following parameter values:
    1. Field Name is zws-id.
    2. API Name is zws-id.
      The API Name will automatically be modified as zillow__zws-id.
    3. Provide a Value in the space provided.
    4. Click Save.
  3. Create a workflow to trigger a function whenever a new lead is created. The script for the function is given below.
Once the integration is authorized, the data will be pulled from Zillow and the records added to  'Properties' module. A related list of the properties will also be displayed in the Leads module.

  1. //Replace the identifiers highlighted in bold with your extension-specific values
  2. LeadId = lead.get("Leads.ID");
  3. datamap = Map:String();
  4. datamap.put("module","Leads");
  5. datamap.put("id",LeadId);
  6. resp = zoho.crm.invokeConnector("crm.get",datamap);
  7. respMap = resp.get("response")._toMap();
  8. users = respMap.get("data");
  9. temp = users.subString(1,users.length() - 1);
  10. usersVal = temp._toMap();
  11. street = usersVal.get("Street");
  12. city = usersVal.get("City");
  13. state = usersVal.get("State");
  14. street1 = street.replaceAll(" ","+",false);
  15. street2 = city + "%2C+" + state;
  16. zwsId = zoho.crm.getOrgVariable("zillow.zws-id");
  17. detail = getUrl("http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=%22 + zwsId + "&address=" + street1 + "&citystatezip=" + street2);
  18. zpid = detail.executeXPath("/SearchResults:searchresults/response/results/result/zpid/text()");
  19. ZillowPropertyId = zpid.toLong();
  20. newDetail = getUrl("http://www.zillow.com/webservice/GetComps.htm?zws-id=%22 + zwsId + "&zpid=" + ZillowPropertyId + "&count=5");
  21. newzpidsList = newDetail.executeXPath("/Comps:comps/response/properties/comparables/comp/zpid/text()").toList("-|-");
  22. for each newzpids in newzpidsList
  23. {
  24.      detail = getUrl("http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm?zws-id=%22 + zwsId + "&zpid=" + newzpids);
  25.      zpid1 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/useCode/text()");
  26.      zpid2 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/bedrooms/text()");
  27.      zpid3 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/bathrooms/text()");
  28.      zpid4 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/finishedSqFt/text()");
  29.      zpid6 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/yearBuilt/text()");
  30.      zpid12 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/parkingType/text()");
  31.      zpid13 = detail.executeXPath("/UpdatedPropertyDetails:updatedPropertyDetails/response/editedFacts/heatingSources/text()");
  32.      createMap = Map:String();
  33.      //Ensure that the "Properties" module has the fields mentioned as keys in the map.
  34.      createMap.put("No_of_Bathrooms",zpid3);
  35.      createMap.put("No_of_Bedrooms",zpid2);
  36.      createMap.put("CustomModule1_Name","Zillow Property Id " + newzpids);
  37.      createMap.put("Built_up_Area",zpid4);
  38.      createMap.put("Heating_Sources",zpid13);
  39.      createMap.put("Parking_Type",zpid12);
  40.      createMap.put("Year_Built",zpid6);
  41.      createMap.put("zillow__Lead",LeadId);
  42.      l = List();
  43.      l.add(createMap);
  44.      dataMapzz = Map:String();
  45.      dataMapzz.put("module","zillow__Properties");
  46.      dataMapzz.put("data",l);
  47.      response = zoho.crm.invokeConnector("crm.create",dataMapzz);
  48.      info response;
  49. }
The value of the custom variable can be modified from the Extension Details page of the CRM.


Create a Read-only custom variable

Characteristic detail
Value
Property in CRM
Read-only
Will changes made to its value from the Developer Console affect existing users?
No
Can its value be modified programmatically?
Yes

To set up a custom variable:
  1. Log in to Zoho Developer Console and click Sigma and select a workspace.
  2. Select the extension to modify and click the Edit Extension [] icon.
  3. Click Custom Properties in the left pane, then click Create.
  4. Provide the following details:
    1. A suitable Field Name.
    2. An API Name.
    3. Value for the variable.
    4. Select ReadOnly from the drop-down.
  5. Click Save

Note The system will append an appropriate prefix to make it unique. For example: If the  Extension Name is  Leads ScoreField Name is  Authtoken, and  API Name is  Authtoken, when the variable is saved, the API name will be set as  leadsscore__Authtoken.

The value of the custom variable can be viewed from the Extension Details page of the CRM.


Create a Hidden custom variable

Characteristic detail
Value
Property in CRM
Hidden
Will changes made to its value from the Developer Console affect existing users?
No
Can its value be modified programmatically?
Yes

To set up a custom variable:
  1. Log in to Zoho Developer Console and click Sigma and select a workspace.
  2. Select the extension to modify and click the Edit Extension [] icon.
  3. Click Custom Properties in the left pane, then click Create.
  4. Provide the following details:
    1. A suitable Field Name.
    2. An API Name.
    3. Value for the variable.
    4. Select Hidden from the drop-down.
  5. Click Save.

Note : The system will append an appropriate prefix to make it unique. For example: If the Extension Name is Leads Score, Field Name is Authtoken, and API Name is Authtoken, when the variable is saved, the API name will be set as leadsscore__Authtoken.

Example
Use a hidden custom variable ' authtoken' to set an organization-specific value during  extension installation.
  1. val = installParamMap.get("organizationId");
  2. valueMap = Map();
  3. valueMap.put("apiname","leadsscore__Authtoken");
  4. valueMap.put("value",val);
  5. resp = zoho.crm.invokeConnector("crm.set",valueMap);
  6. info resp;





    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            Zoho Marketing Automation

                                              Zoho Sheet Resources

                                               

                                                  Zoho Forms Resources


                                                    Secure your business
                                                    communication with Zoho Mail


                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times


                                                      Carry your calendar with you
                                                      Anytime, anywhere




                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now




                                                                      Zoho TeamInbox Resources



                                                                              Zoho DataPrep Resources



                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW


                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now









                                                                                                      • Related Articles

                                                                                                      • Developing Third-party Integrations - Connectors

                                                                                                        The guide will help you with the following: Oauth 2.0 Create a connector  Add APIs  Publish the connector  Associate to an extension  Invoke connectors  Sample Connector   Zoho offers integration support for a wide range of third-party applications, ...
                                                                                                      • Integrating with third-party applications

                                                                                                        Each industry comes with a unique set of problems to solve. To accommodate this diversity within the business world, we've created the Zoho Developer console, which allows you to integrate almost any third-party application with your CRM ...
                                                                                                      • Connectors

                                                                                                        Connectors power up your CRM and add functionalities by Integrating with other services through its APIs (OAuth 2.0). Getting Started with Connectors Connectors enable the process of establishing integrations between the solutions built over Vertical ...
                                                                                                      • Custom Functions

                                                                                                        The guide will help you with the following: Create Custom Functions Program Custom Functions  Test Custom Functions  Associate with Workflow Rules  Manage Custom Functions  Custom functions help in automation where procedural logic is required, which ...
                                                                                                      • Custom SalesSignal

                                                                                                        The SalesSignals feature in Zoho CRM provides real-time notifications of all touch points from your leads, contacts, or potential customers. You can keep track of all the customer interactions across various channels and follow-up with them from one ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

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



                                                                                                          eBooks

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



                                                                                                          Webinars

                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.



                                                                                                            Zoho Show Resources