Automation #3 - Auto-sync email attachments to tickets

Automation #3 - Auto-sync email attachments to tickets




This is a monthly series where we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk.









Most of our customers use email as their primary channel for customer support. Keeping that in mind we ensured Zoho Desk's multi-channel capability allowed for every email received in your inbox to be automatically converted into tickets in Zoho Desk. But for some time now, we have been receiving question on how to convert email attachments into ticket attachments within Zoho Desk. This process, which is mostly achieved manually now by many customers, can be automated using a simple script.




This automation involves two components: a connection and a workflow rule. We will first start by creating the connection and then set up the workflow rules to execute the custom function.






To create the connection, perform the following steps:
  1. Go to Setup > Connections under Developer Space
  2. Click "Create Connection"
  3. Select "Zoho Desk" under "Default Services"
  4. Give the connection name as "ticketattachment"
  5. Under Scope below values
    Desk.tickets.READ
    Desk.tickets.UPDATE
  6. Click "Create and Connect"

  7. Click "Connect" and click "Accept"


Connection is created successfully.

To create workflow rule and associate custom function, perform the following steps:
  1. Go to Setup, and under Automation, click Workflows.
  2. On the left panel, under Workflows, click Rules > Create Rule,
    In the Basic Information section, carry out the following steps:
  3. In the Module drop-down menu, select Tickets.
  4. Enter a name and description for the rule.
  5. If you want to activate the rule right away, select the Active checkbox. Else, you can just create the rule now and activate it later, on the Rules page.
  6. Click Next.
    In the Execute on section, perform the following steps:
  7. Select the Create checkbox to execute this rule every time a new ticket is created. 
    NOTE: If you would like to fetch all the attachment sent out and received in tickets, select "Customer Reply" and "Agent Response"
  8. Click Next, skip the "Criteria" and Click Next.
  9. In the Actions section, carry out the following steps:
  10. Click the + icon under "Action" and select "New" next to Custom Functions
  11. Enter a name and description for the custom function.
  12. In the script window, input the Custom Function you find below:

    1. //Replace your zoho desk URL accordingly
    2. getTicketThread = invokeurl
    3. [
    4. url :deskDomain + "/api/v1/tickets/" + ticketID + "/latestThread"
    5. type :GET
    6. connection:"ticketattachment"
    7. ];
    8. dir = getTicketThread.get("direction");
    9. info "Direction " + dir;
    10. if(dir == "in")
    11. {
    12. prefix = "customer_";
    13. }
    14. else
    15. {
    16. prefix = "agent_";
    17. }
    18. listAttachments = getTicketThread.get("attachments");
    19. for each  attach in listAttachments
    20. {
    21. attachmentURL = attach.get("href");
    22. filename = prefix + attach.get("name");
    23. getAttachment = invokeurl
    24. [
    25. url :attachmentURL
    26. type :GET
    27. connection:"ticketattachment"
    28. ];
    29. if(getAttachment != null)
    30. {
    31. if(isText(getAttachment))
    32. {
    33. getAttachment = getAttachment.toFile(filename);
    34. }
    35. //info getAttachment;
    36. param = Map();
    37. param.put(filename,getAttachment);
    38. getAttachment.setParamName("file");
    39. uploadResponse = invokeurl
    40. [
    41. url :deskDomain + "/api/v1/tickets/" + ticketID + "/attachments"
    42. type :POST
    43. parameters:param
    44. headers: {"Content-Type":"multipart/form-data"}
    45. connection:"ticketattachment"
    46. ];
    47. info uploadResponse;
    48. }
    49. }



  13. Click Edit Arguments
  14. In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Information
  15. Click "Save" to save the custom function

  16. Click "Save" again to save the workflow.
This should help you fetch attachments from incoming or outgoing response of a ticket and update them under tickets attachments tab.
    • 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

    Nederlandse Hulpbronnen


      • Recent Topics

      • Introducing Connected Records to bring business context to every aspect of your work in Zoho CRM for Everyone

        Hello Everyone, We are excited to unveil phase one of a powerful enhancement to CRM for Everyone - Connected Records, available only in CRM's Nextgen UI. With CRM for Everyone, businesses can onboard all customer-facing teams onto the CRM platform to
      • Automation#17: Auto-Create Tasks in Zoho Projects Upon Ticket Creation in Zoho Desk

        Hello Everyone, This edition delivers the solution to automatically create a task in Zoho Projects when a ticket is created in Zoho Desk. Zylker Resorts uses Zoho Desk for bookings and handling guest requests. Zylker resorts outsources cab bookings to
      • Automation#20 : Auto-Add Ticket Tags based on Keywords

        Hello Everyone! Welcome to unveiling custom functions on our Community series. This week's post lets you add tags to your tickets automatically based on the keywords in the ticket subject and the ticket thread. Discover how this custom function helps
      • Automation#21: Track Ticket Transfers Across Departments

        Hello Everyone! With Halloween just around the corner, we'd like to let you know the Zoho Desk team is always there to sweep away your customer service troubles! This week, we’re excited to introduce a custom function that tracks tickets moved between
      • Email Integration - Zoho CRM - OAuth and IMAP

        Hello, We are attempting to integrate our Microsoft 365 email with Zoho CRM. We are using the documentation at Email Configuration for IMAP and POP3 (zoho.com) We use Microsoft 365 and per their recommendations (and requirements) for secure email we have
      • Uplifted homepage experience

        Hello everyone, Creating your homepage is now much easier, more visual, and more impactful. Until now, your homepage allowed you to display custom views, widgets, analytic components, and Kiosk. With the following improvements, the homepage is now a smarter,
      • Homepage not assignable to group

      • MS Teams for daily call operations

        Hello all, Our most anticipated and crucial update is finally here! Organizations using Microsoft Teams phone system can now integrate it effectively with Zoho CRM for tasks like dialling numbers and logging calls. We are enhancing our MS Teams functionality
      • Automation#22 Track Ticket Duration at Specific Status

        Hello Everyone! Welcome back to the Community Learning Series! Today, we explore how Zylker Techfix, a gadget servicing firm, boosted productivity by tracking the time spent at a particular ticket status in Zoho Desk. Zylker Techfix customized Zoho Desk’s
      • Automation#23: Automate Guided Conversations in Zoho Desk with Business Hours

        Hello Everyone, This week's edition introduces a custom function designed to automate Guided Conversations in Zoho Desk, based on your business hours. With this feature, you can align the bot's behavior with your business schedule, ensuring a smooth and
      • Address changes in quote form

        When entering a quote, the first piece of information required is the Account, which properly populates the billing and shipping address fields. Then I use the lookup function to select a contact, and when I do, the billing and shipping addresses are
      • Automation#24: Auto-Update custom field from Accounts to Tickets

        Hello Everyone! Welcome back to the Community Learning Series! This episode dives into how Zylker Techfix streamlines account-related ticket references. Previously, employees had to manually check account details to retrieve specific customer information,
      • Automation#31: Automate Splitting Names for New Contact Records

        Hello Everyone, This week, we present to you a custom function, which allows you to split the first and last names from the user's email ID based on the separator used in the ID. Having grown into a large firm, Zylker Techfix aims to optimize its processes,
      • The same Contact associated to multiple Companies - Deals

        Hi, I would like to know if there is an option to associate the same contact with multiple companies (two or more) deals, using the same contact details for all. This is because we have contacts who are linked to different companies or branches of the
      • local file csv import problem

        The issue occurs when I upload a CSV file via Databridge. In the preview, everything looks correct — the values are in the proper columns. However, after clicking Import, the first column becomes empty, and the values from that column appear in a new
      • Kaizen #227 : Client Script Support for List Page (Canvas)

        Hello everyone! Welcome to another week of Kaizen. In today's post lets see how Client Script can be used in Canvas List Page to mask sensitive information from specific roles and add colors to Canvas List Page records based on custom criteria.This use
      • Implement Date-Time-Based Triggers in Zoho Desk

        Dear Zoho Desk Support Team, We are writing to request a new feature that would allow for the creation of workflows triggered by specific date-time conditions. Currently, Zoho Desk does not provide native support for date-time-based triggers, limiting
      • Automation#25: Move Tickets to Unassigned When the Owner Is Offline

        Hello Everyone, Welcome to this week's Community Series! 'Tis the holiday season—a time when work often takes a brief pause. The holiday spirit is in full swing at Zylker Techfix too, with employees taking some well-deserved time off. During this period,
      • Automation#27: Retain Ticket Owner on Moved Tickets

        Hello Everyone! This week, we present to you a custom function that retains the ticket owner when a ticket is moved from one department to another. Here’s more to help you understand the custom function: At Zylker Techfix, Alex, the Support Engineer manages
      • Automation#28 Notify Agents on Article Expiry

        Hello Everyone! This week, we’re bringing you a feature that notifies your team when articles in the Knowledge Base are set to expire to keep your content relevant and helpful for customers. The Zoho Desk's Knowledge Base is an asset for customers to
      • Automation#29 Retain ticket status on moved tickets

        Hello Everyone, Hear out Zylker Techfix’s Success Story on Smoother Ticket Transitions! Zylker Techfix, a gadget servicing firm committed to quick repairs and timely deliveries, faced a challenge when ticket statuses changed automatically while moving
      • encountering an error when attempting to associate an email with a Deal using the Zoho CRM extension in Zoho Mail.

        When I click "Yes, associate," the system displays an "Oops!! Something went wrong" error message. I have attached a screenshot of the issue for reference.
      • Automation#32:Auto Add New Portal Users to the Help Center User Groups

        Hello Everyone, Introducing a custom function that automates the process of adding new portal users to Help Center user groups, making user management effortless! By default, Zoho Desk allows you to assign new portal users to groups manually. But with
      • Using email "importance" as workflow-criteria

        I'd like to set up a workflow that triggers if an incoming email has been flagged as "high importance" but I'm not seeing any way to do that. Hopefully I'm just missing something obvious...?
      • Automation#34 : Automate Email threading for Ticket notification

        Hello Everyone, It's been a while since we've presented an automation. However, our community has been buzzing with ideas, use cases, and discussions with our community experts and Ask the Experts session. So, here we are again, presenting an automation
      • Automation#35 : Auto-Add Comments under the Owner's Name in Tickets via Macros

        Hello Everyone, This week's custom function provides simple steps to configure a Macro for adding comments to tickets with the name of the Comment owner. When managing tickets, you can use the Comment feature to communicate internally with your team and
      • Automation#36: Auto-create time-entry after performing the Blueprint transition

        Hello Everyone, This week’s edition focuses on configuring a custom function within Zoho Desk to streamline time tracking within the Blueprint. In this case, we create a custom field, and request the agent to enter the spending time within the single
      • Automation#33: Automate Splitting Names for Existing Contact Records

        An organized directory – who doesn't love one? Previously, we explored how to split contact names into First Name and Last Name for new contacts in Zoho Desk. But what about existing contacts already in your database? This week, we bring you a custom
      • About Meetings (Events module)

        I was working on an automation to cancel appointments in zoho flow , and in our case, we're using the Meetings module (which is called Events in API terms). But while working with it, I'm wondering what information I can display in the image where the
      • import data from Apollo.ai into zoho crm via zoho flow

        I might be asking this question in the wrong forum. We use Apollo.ai to find potential new leads for our business, there are around 10000 leads that we have initially found. We have an Apollo.ai account but just to do searches, we dont use it as a crm.
      • Fix the speed

        It takes ages to load on every step even though my dataset is quite small.
      • Workqueue

        I really like the idea of the Workqueue generally - it will be really useful. What it seems to lack however, is the ability to customise it properly. I want to be able to show a custom view rather than just "My Leads" and "Leads Assigned in Last 3 hours".
      • Webform & spam

        Hi, We set up 2 webform on our website, fowarding the content to Zoho CRM. Since it has been opened up, we are getting lot of spam message (for now about 20 a day). To lower the amount of false new leads we added the captcha field and new enquieries are
      • Zoho CRM Web form page URL

        Hi there, I am getting quite a bit of spam through my Zoho CRM Web form and want to restrict the URLs it is submittable from. I can see that I can add Location URLs but I need to be able to just add a domain so can I enter mydomain.com/* to cover all
      • Receiving too many Spam Leads. Why?

        I am receiving so many junk leads from web forms created by zoho's platform. The junk queries are increasing day by day and are affecting our business. I am continuously following up with zoho team from the past one year but not getting any satisfactory
      • Mail Merge is not working properly as far as the AUTOMATE section is concerned

        Hi there, I created a Mail Merge template for the Deal module. I would like Deal owners to mail merge their Deal records, download the Mail Merge document as a Word doc and make a few changes before sending it to the customer. Thing is, neither the "Merge
      • Canvas Detail View Related List Sorting

        Hello, I am having an issue finding a way to sort a related list within a canvas detail view. I have sorted the related list on the page layout associated with the canvas view, but that does not transfer to the canvas view. What am I missing?
      • project name field issue- n8n

        Hey guys, I have a question. I want to create a new product using the workflow. The problem is with the product name field; I don't know how to fill it in. The workflow starts with retrieving information from the leads table, retrieving links to scrape
      • Function #20: Custom calculation in item table of invoices

        When you create an invoice in Zoho Books, the 'Amount' of a line item is typically calculated as the product of the "Quantity" and the "Rate" of the item. For instance, if an item has a sales rate of $50 and a quantity of 5 is sold, then the amount would
      • Flexible Partial-Use Coupons (Stored Value Credits)

        Subject: Feature Request: Ability for users to apply partial coupon balances per transaction Problem Statement Currently, our coupons are "one-and-done." If a user has a $50 coupon but only spends $30, they either lose the remaining $20 or are forced
      • Next Page