Automation #15: Automatically Adding Static Secondary Contacts

Automation #15: Automatically Adding Static Secondary Contacts



Rockel is a top-tier client of Zylker traders. Marcus handles communications with Rockel and would like to add Terence, the CTO of Zylker traders to the email conversations. In this case, the emails coming from user address rockel.com should have Terence looped in automatically as the secondary contact.

Like Zylker, many users have the requirement to include secondary contacts while communicating with their customers. Here's for you the custom function to automatically add static secondary contacts while responding to an email.

Prerequisite
1. Enable Secondary Contacts (CCs) in Tickets
Navigate to Setup >> Customization >> General Settings >> Tickets >> Secondary Contacts (CCs) in Tickets >> Configure(If not enabled) or Edit Configuration(If enabled), select the department to which you want to implement the automation.


2. Create a Connection
To establish a connection, perform the following steps:

      2.1 Go to
Setup and choose Connections under Developer Space.
      2.2 Click
Create Connection.
      2.3 Select
Zoho OAuth under Default Connection.
      2.4 Give the connection name as
secondarycontact.
      2.5 Under
Scope choose the below scope values:
            Desk.search.READ
            Desk.tickets.READ
            Desk.tickets.UPDATE
            Desk.tickets.CREATE
            Desk.contacts.READ
            Desk.contacts.UPDATE
      2.6 Click Create and Connect.
      2.7 Click
Connect and click Accept.
Connection is created successfully.

Create a Workflow Rule
1. Go to Setup, choose Workflows under Automation.
2. Under Workflows, click Rules >> Create Rule.
In the Basic Information section
3. Select Tickets under Module.
4. Enter a Rule Name and Description for the rule.
5. To activate the rule, select the Active checkbox. Click Next.
In the Execute on section, follow these steps:
6. Select Create checkbox to execute this rule every time a new ticket is created. Click Next.
7. In the Criteria section, specify the criteria as "Email contains @zylker.com" and click Next
8. In the Actions section, click the + icon and select New next to Custom Functions.
9. Enter a name and description for the custom function.
10. Under Argument Mapping, give a desired Method Name. Map the arguments as below 
   10.1 In the Argument Name field , type ticketId, and from the Value drop-down list select Ticket Id under Ticket Information.
   10.2 In the Argument Name field , type ticketContactId, and from the Value drop-down list select Contact Id under Contacts Information.
   10.3 In the Argument Name field, type orgId, and from the Value drop-down list select specify custom value and enter your Zoho Desk. OrgId. To  get Zoho Desk OrgId, navigate to Setup >> Developer Space >> API.                  
11. In the script window, insert the Custom Function given below:
  1. //--------------- User Input -----------------
  2. Email = "STATIC_EMAIL_ID"; // Static email ID
  3. deskURL = "https://desk.zoho.com";
  4. //-----------------------------------------------
  5. logs = Collection();
  6. secondaryContacts = list();
  7. ticketDetails = zoho.desk.getRecordById(orgId, "tickets", ticketId, "secondarycontact");
  8. logs.insert("ticketDetails": ticketDetails);
  9. secondaryCC = ticketDetails.get("secondaryContacts");
  10. if (secondaryCC != "" && secondaryCC != null)
  11. {
  12. secondaryContacts = secondaryCC.toList(",");
  13. }
  14. searchParam = Map();
  15. searchParam.put("from", 0);
  16. searchParam.put("limit", 1);
  17. field1 = "email:" + Email;
  18. encryptEmail = zoho.encryption.urlEncode(field1);
  19. searchParam.put("field1", encryptEmail);
  20. contactSearch = invokeurl
  21. [
  22. url: deskURL + "/api/v1/contacts/fieldSearch"
  23. type: GET
  24. parameters: searchParam
  25. connection: "secondarycontact"
  26. ];
  27. logs.insert("contactSearch": contactSearch);
  28. if(contactSearch != null && contactSearch.get("data") != null && contactSearch.get("data").size() > 0)
  29. {
  30. contactId = contactSearch.get("data").get(0).get("id");
  31. }
  32. else
  33. {
  34. createConatctParam = Map();
  35. lastName = Email.getPrefixIgnoreCase("@");
  36. createConatctParam.put("lastName", lastName);
  37. createConatctParam.put("email", Email);
  38. createContact = invokeurl
  39.     [
  40.      url: deskURL + "/api/v1/contacts"
  41.      type: POST
  42.      parameters: createConatctParam.toString()
  43.      connection: "secondarycontact"
  44.     ];
  45. logs.insert("createContact": createContact);
  46. contactId = createContact.get("id");
  47. }
  48. logs.insert("contactId": contactId);
  49. if(contactId != null && contactId != ticketContactId)
  50. {
  51. secondaryContacts.add(contactId);
  52. updateParam = Map();
  53. updateParam.put("secondaryContacts", secondaryContacts);
  54. updateTicket = invokeurl
  55.     [
  56.         url: deskURL + "/api/v1/tickets/" + ticketId
  57.         type: PATCH
  58.         parameters: updateParam.toString()
  59.         connection: "secondarycontact"
  60.     ];
  61. logs.insert("updateTicket": updateTicket);
  62. }
  63. info logs ;
Note: In Line 1 Email = "STATIC_EMAIL_ID", replace the "STATIC_EMAIL_ID" with the email address you prefer to be added in the secondary contact automatically. eg:  Email = "terence@zylker.com"
12. Click Save to save the custom function
13. Click Save again to save the workflow.

We hope this custom function fosters your experience with Zoho Desk. Stay tuned for regular updates and insights on our automation features in this space.

    • Sticky Posts

    • Register for Zoho Desk Beta Community

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

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

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

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

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

    • Cyclic dependencies in many-to-many relationships...

      I have an application which includes a form for companies, and a form for contacts. Each company can be assigned 1 technical and 1 administrative contact. I have this working okay so far, but I want to copy the scripts used so far to a new empty application. When I import the scripts it fails with a message that says: Problem encountered while creating the application Error in resolving form dependency:Cyclic dependency among the forms:[Company, Contact] What can I do to resolve this? After all,
    • Zia’s AI Assist now helps you write clearer notes — in seconds

      After helping recruiters craft job descriptions, emails, and assessments, Zia’s AI Assist is now stepping in to make note-taking effortless too. Whether you’re recording feedback after an interview or sharing quick updates with your team, you can now
    • Building toppings #1 - Serving your needs with Bigin toppings

      Hey Biginners! We're excited to kick off our Developer Community series on building toppings for Bigin, and our goal is to provide an accessible, beginner-friendly, and relevant path for every developer. Imagine creating tiny pieces of software that unlock
    • Can we create Sprint with tasks from Multiple projects?

      Hi Team, We were using Zoho Sprints for quite sometime. Currently we have started the process of Sprint method. We couldnt create the active sprint board with the tasks from multiple projects. I would like to know whether this is possible or Any timeline
    • Can we handle a support like (incident management) project in Zoho Projects?

      Hi, I have a new profile of a project whereby we provide "ticket" base support to a client. They have a request and ideally we would handle comms via a email exchange logged in Zoho. Today we use Zoho Projects for all out projects, which means that we
    • Tip of the Week #74– Create automated workflows in MS Power Automate

      Zoho TeamInbox now connects directly with Microsoft Power Automate, letting you streamline everyday routines tasks such as from sending emails to managing threads, with automated workflows. About the integration Zoho TeamInbox integrates with Microsoft
    • Account validation

      Hello everyone, I registered my account on ZeptoMail to use the system, but the problem is that the verification period on Zepto's end has already passed and I have limited functionality.
    • Paste issues in ZOHO crm notes

      Hi, since a week or so I have issues with the paste function in ZOHO CRM. I use "notes" to copy paste texts from Outlook emails and since a week or so, the pasting doesnt function as it should: some text just disappears and it gives a lot of empty lines/enters.....
    • Is it possible to add a gradient color to a newsletter im designing?

      From where i sit it looks like you can only choose a single color but not combine 2 colors?
    • New Feature: Audit Log in Zoho Bookings

      Greetings from the Zoho Bookings team! We’re excited to introduce Audit Log, a new feature designed to help you track all key actions related to your appointments. With Audit Log, you can maintain transparency, strengthen security, and ensure accountability.
    • Custom validation in CRM schema

      Validation rules in CRM layouts work nicely, good docs by @Kiran Karthik P https://help.zoho.com/portal/en/kb/crm/customize-crm-account/validation-rules/articles/create-validation-rules I'd prefer validating data input 'closer to the schema'
    • Customised Funnel

      We are running the standard plan for our ZOHO CRM. I have been asked if there is a way to combine data from the Calls module, Deals module and Contact Module into 1 funnel, similar to the view you can get when viewing Deals By Stages, you can see the
    • How to restrict user/portal user change canvas view

      Hi , I would like to restrict user / portal user change their canvas view because I hide some sensitive field for them. I dont want my user switch the canvas view that do not belong to them But seems Zoho do not provide this setting?
    • Good news! Calendar in Zoho CRM gets a face lift

      Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
    • Account disabled

      I have an issue I need help with. Whilst trialing ZOHO CRM I created the following: Account1 (-------------) using m__ame@m__rg___s__i__.___.__ and 2 personal emails Account2 (-------------) using a personal email and 2 users _al__1@______________._o_.__
    • Blocked Email

      We are a Zoho One subscriber and use Yahoo as our MX provider. A few times each year, for the past four years, CRM blocks one or more of my Zoho One users from receiving internal email from CRM. This includes "@mentions" in all modules, and emails from
    • message var is empty in bot mention handler

      Hi, I'm encountering a problem: in my bot's mention handler, I want to retrieve the text the user typed when mentioning the bot. Example: On the #tests-cyril channel, I send this message: “@Donna hello how are you ?” I expect the system variable "message"
    • Develop Zoho Meeting as a Full Native Application (Not a Browser Wrapper)

      Hello Zoho Meeting Team, Hope you are doing well. We would like to suggest an important improvement regarding the Zoho Meeting desktop application. At the moment, the Zoho Meeting app feels more like a mini browser window or an iframe that loads the web
    • Enhancements to Zoho Meeting Annotator

      Hello Zoho Meeting Team, Hope you are doing well. We would like to share a few improvement suggestions regarding the Zoho Meeting Annotator used during screen sharing. While the current version provides helpful annotation tools, there are several limitations
    • Remembrance Day to Remember – Recalling Values

      The phrase “at the eleventh hour” refers to the 11th hour of the 11th day of the 11th month in 1918, when the hostilities of World War I came to an end—but it still holds meaning today. Remembrance Day (Veterans Day in the US) is observed on November
    • Enhancing Zia's service with better contextual responses and article generation

      Hello everyone, We are enhancing Zia's Generative AI service to make your support experience smarter. Here's how: Increased accuracy with Qwen One of the key challenges in AI is delivering responses that are both contextually accurate and empathetic while
    • How to display two measures (sales and price) divided by categories on one line chart

      Hi everyone, I’m having trouble figuring out how to display two columns on a line chart with category breakdowns. What I need is a line chart where one line represents Sales and the other represents Price. However, the Price data is divided into around
    • Create custom rollup summary fields in Zoho CRM

      Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
    • Introducing the locking option for CRM records

      Last modified on 06/04/2023: Record locking option in CRM is now available for all Zoho CRM users in all DCs. Note that it was an early access feature available only upon request. Hello All, Hope you're doing well! We're thrilled to introduce our latest
    • Two new enhancements in Zoho CRM: Introducing new criteria for user fields and displaying group information in users page

      Announcement moderated on 14th June, 2023. Dear All, These enhancements are opened for all users in all DCs. ------------------------------------------------------------------------------------- Dear All, Hope you're well! We are here with two useful
    • Tip #49- Navigating the Remote Support Dashboard in Zoho Assist- 'Insider Insights'

      The Remote Support dashboard in Zoho Assist is designed to help technicians quickly access, manage, and monitor all their support sessions from a single, intuitive interface. Whether you’re starting a new session, managing ongoing connections, or reviewing
    • BMI formula

      I've been trying for hours to calculate BMI using height and weight as my only inputs. It's a simple calculation and I even went to ChatGPT to help me figure this out in Zoho Forms, but it led me down a path of "try this" and "try this". None of my attempts
    • SEO on blogs

      Hello, google is not able to find my blogs. Can you advice me if I need to change some settings or anything else to make it retrievable via SEO many thanks, hans
    • Duplicated Notebooks

      Out of the blue, almost all of my notebooks got duplicated and the different copies contain different information. Some seem like older copies than the others. I use the linux desktop app and sometimes the Android app. I assume that the sync failed at some point and was unable to merge the two versions together. But I'm afraid to add anything else to my notebook because if it can't properly sync 5 notebooks with only a handful of notes each, what will happen when I have hundreds of notes and I lose
    • Samsung Keyboard Issues with Notebook

      Dear Users, We're sorry to inform you that some of our users are experiencing certain issues like scrolling, delay/lag, cursor placement especially within the text notes. This occurs mainly due to Samsung Keyboard compatibility with Android 13 and some
    • Mind mapping in Zoho Projects

      Good morning,   I would like to congratulate the Zoho team for building such an inovative and responsive application that fits in the daily challenges of so many work groups. I would like suggest you another functionality that helps a lot in project planning and development: mind mapping. Mind mapping would be of great help for brianstorming, knowledge management and other needs in online collaboration.   Thanks and wish you all the best! George Maha Empresa Júnior Multidisciplinar do Instituto de
    • Trying to show the actual Terms & Conditions on PDF

      Hi, On Zoho forms I am trying to have the actual terms and conditions that the user needs to accept also show on the pdf that they receive after. Right now it only says "Agreed". Please help.
    • Retainer invoice in Zoho Finance modlue

      Hello, Is there a way of creating retainer invoices in the Zoho Finance module? If not can I request this is considered for future updates please.
    • Introducing the revamped What's New page

      Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
    • What's New in Zoho Inventory | August – October 2025

      Hello customers, The last quarter has been incredibly productive! We've released a powerful slate of new features and enhancements in Zoho Inventory designed to give you better control, greater efficiency, and expanded functionality across your inventory
    • Documents don't sync properly

      Hello, My team recently moved to Zoho workDrive, some of my team, work remotely so we believed Zoho would be the best way to share and edit files as well as access files withing the team. However we are experiencing sync issues, when a file is uploaded in the file explorer and shows sync complete, same file can be seen on the Zoho web app but other team members can't see the said file because it is not syncing properly. i figured out that if i were to go to preferences in settings and resync the
    • We are looking for an experienced Zoho Developer

      Hi Everyone! We’re on the lookout for a skilled Zoho Developer with hands-on experience in the Zoho Developer Platform (The Vertical CRM Platform) and if you don't know what that is, then you are not the person we are looking for. You would also need
    • Initiate approval workflow after "on edit --> on success"

      Dear Community,  currently I am working on a initiative tracker which should handle approval workflows based on different initiative status. As far as I understand, an approval workflow can be triggered (only?) when data is entered for the input form to the database.  Example: A new initiative is created and submitted. --> Approval Workflow triggered Here comes my question: Is it also possible to trigger an approval workflow if the form was "simply" updated? (on edit --> on success) Imagine the initiative
    • Zoho Social/Marketing Plus - Addition to "Monitor" function

      It would be very helpful if the Monitor function would allow us to add a column to monitor hashtags in addition to pages and mentions. This is a common and very valuable function in other social listening tools.
    • Tax Deductible Donations to a Charity Organisation

      For Australia, what's the best/proper method for entering an expense that is a tax deductible donation to a charitable organisation. And thus is appears correctly in Accounts and BAS as a GST payable deduction?
    • Next Page