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 OAuth" under "Default Connection"
  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

        • Recent Topics

        • Global "Search" in FSM

          I'm missing the global Search function like in CRM. This should save us a lot of time. We don't now upfront if the customer is a Contact or a Company. So now we have to guess in what module to start a search/filter. Also looking up an address, phone number,
        • inventory template

          is it possible to implement if condition within inventory template?
        • Introducing Assemblies and Kits in Zoho Inventory

          Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
        • Automate Zoho Meeting Creation via Blueprint (Leads & Accounts)

          I need help automating Zoho Meeting creation during a blueprint transition in both the Leads and Accounts modules. Requirements: Triggered via blueprint Read meeting start time (DateTime field) and internal participants from CRM Create Zoho Meeting via
        • Invalid OAuth Token When Using Zoho CRM API with Postman

          We're in the process of integrating Zoho CRM with our Django backend and currently testing the API endpoints via Postman. I've forked Zoho's official CRM REST API collection in Postman for this. Steps Taken: Created a Self Client via Zoho API Console:
        • How to find the number of companies within contacts

          I'm trying to track our database growth and want to find out how many companies we have in our database. is there an easy way to do this? Moderation Update: I'm locking this post, as we have an ongoing discussions in this linked post. You can follow the
        • Want to setup automation

          I would like to send mail automatically after 7 days when stage is approved using Bigin Automation. Can you guide. I tried and attached the screenshot but it seems to be not working well.
        • Generate a Zoho Sign link

          From time to time I get a response "I never received your you e-document for electronic signature" is there a way to generate a Zoho Sign link to share.
        • Highlight a candidate who is "off limits"

          Hello: Is there a way to highlight a candidate who is "off limits"?  I would like to have the ability to make certain candidate and / or Client records highlighted in RED or something like that.   This would be used for example when we may have placed a candidate somewhere and we want everyone in our company to quickly and easily see that they are off limits.  The same would apply when we want to put a client or former client off limits so no one recruits out of there. How can this be done? Cheers,
        • Feature Request - Approval Processes

          Hi Team, I think it would be really valuable to add the approval process feature like what is currently available in the CRM. The problem with the current approval support is it can't be automated to send the approval to set people based on the values of fields within the tickets. Is this something that could be considered for the roadmap? Thanks, Harry
        • What is VoC "Unique count", counting?

          Using the "Response based sentiment analysis" dashboard, here is our VoC "Overall Count by Sentiment" VoC uses Zoho Survey and email...and we have almost certainly touched (via email) more than 401 Contacts since January 1, 2025.
        • Knowledge base articles is now available in the Zoho Desk mobile app!

          Hello all,   As a customer service agent, every day you might have to deal with many questions and issues reported by the users. With Knowledge Base, you can reduce the issue resolution life cycle for your organization.   We are delighted to announce that we have brought in support for 'Knowledge Base articles' in the Zoho Desk iOS mobile app.  This feature is already available for Android users.   KB articles are available to iOS users in the latest version of the app (v2.4.9). You can update the
        • Document data extraction and import into CRM.

          I've been trying to solve this for a while and I can't come up with a workable solution: In our business, we utilize many subcontractors around the world (without Zoho user accounts) to produce reports and client sites which they then submit back to us
        • Notifications API - how to handle channel expiry

          The Documentation doesn't give a lot of detail on how the Notification API should be used. Am I correct that I can only open a channel for a maxmimum of 24 hours? And once the channel_expiry date has passed, I will no longer receive notifications? What
        • Introducing ICR in Zoho CRM: Transform your printed text into digital data

          From writing on papyrus in the ancient times to creating a humble record in your CRM, the world may have evolved with how it used to record data, but data entry as such has not been simplified. It is still a repetitive and arduous chore on which businesses
        • Sync Books quote value into Deal amount

          I have books integrated into deals in CRM and I want to sync the quote value into the deal value automatically. Can anyone provide me some guidance?
        • Can I add Conditional merge tags on my Templates?

          Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
        • Repeat script N number of time with some incrementation

          Hi, I have a script I want to repeat a certain number of time, depending on a value from a variable NumberOfDelivery, and at a certain frequency depending on a variable DaysBetween (wich would afect my addday function on the last line). Here is the basic
        • 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
        • Filter a report for a specific bank and a specific transaction type (interest income)

          I am trying to run a report - any report - on a specific bank account for the interest income. I do not see it as an option. I can see the Bank Account under Account in the Filters, and I can see the Interest Income under Account in the Filters But I
        • Pin multiple columns and adjust column widths in CRM subforms

          Hello all, Subforms act as secondary forms or tables in which you can associate multiple line items to a primary record and thereby ensure more structured and comprehensive data organization. We've made some recent enhancements to subforms. Here's what's
        • Exchange Rate Updates

          Hi, It would be great that when you work with multiple currencies, the exchange rate updates automagically every day (as seen on Zoho Books) or at least that when you create/update an opportunity the exchange rate could be manually updated, or maybe both!
        • Add Video block needs improvement

          I regularly send out links to videos in my campaigns and I find that built in video block is never good enough to use in my campaigns, so I have to make a thumbnail in Canva and upload it or screenshot the actual video on YouTube. The concept of the video
        • Function #35: Close all tasks associated with a lead and create a new task.

          Welcome back everyone! Last week, we learnt how to close all tasks of a deal depending upon the deal stage. This week, let's look at a custom function that lets you close all of the tasks associated with a lead while simultaneously creating a new task, like when you need to halt all progress towards a lead while the lead is not available at the moment but create a reminder task. Business scenario: The success of a company, in one way or another, is determined by the leads it gets. Each lead is just
        • No Teamspace found in CRM Sandbox

          I created a new Sandbox and selected a custom Module I have admin role but still when I open the sandbox I get this, how can I resolve this
        • How do I create a time field?

          I want a field that only records time. I can only see how to create a date-time field. If I do that and enter a time, without a date, nothing is recorded. If I create a number or decimal field, I cannot use it in time calculations. All I want is a field
        • MS Teams Meeting to Zoho CRM

          Has anyone figured out a good way to push MS Teams meeting info on a trigger of "meeting end" to Zoho CRM? We're looking for a way to take attendees of a meeting and meeting duration and push it into Zoho CRM after the meeting has ended. If I can just
        • Run automation on quiz completion

          Hello, We're exploring Zoho Learn as a possible solution to creating some training courses to external users on our system. We'd like to run a workflow/ integration to Zoho CRM when a course is completed. Is this possible?
        • MArking as NOT SPAM

          I have just been checkign my SPAM folder and it seems that markign mails as NOT SPAM makes them disappear. I cannot find them in my mailbox with a search.
        • Data Import validations

          Hi, I currently have a CSV file download from a 3rd party SFTP server prior to performing the data transform. When we don't have any transactional data, a file is still uploaded by the 3rd party to the server, but it is blank. This causes the transform
        • Custom Extension, create a trigger button in custom module to launch the app, or any workaround

          Hello Have created a custom extension , publish as private, all working But I'm facing an issue For my test I create a button in accounts or Contacts module to launch the app. But how I can handle to create same button in a custom module (not created
        • New Customization options in the module builder: Quick Create and Detail view

          Hello everyone, We have introduced two new components to the module builder: Quick create and Detail view. The Quick Create Component It is a mini form used to create a record and associate it to the parent record from a lookup field. For example, if you have a Deals lookup in the Contacts module, then you can associate existing deals or create a deal and associate it with the contact. You can customize this Quick Create form by adding standard as well as custom fields. There is no limit to the number
        • How to abort a report email schedule if query is empty?

          I am needing a way to create scheduled condition alerts when certain criteria exist in our Zoho Reports databases. I don't want to send a report/alert email if the query/condition is nonexistent/empty. How would I do that with the Zoho Reports Scheduling feature?
        • Can External users upload files or images to WorkDrive?

          I want to know if it is possible for someone externally through a link and PW be able to upload files and images onto WorkDrive?
        • Zoho Creator HTML Page

          Hello Team, I have a query related to the HTML page I created in Zoho Creator. I would like to apply some filters on this page without passing them through URL parameters. Could someone please guide me on how this can be achieved? Thanks & Regards, Piyush
        • Tables for Europe Datacenter customers?

          It's been over a year now for the launch of Zoho Tables - and still not available für EU DC customers. When will it be available?
        • Payroll in Saudi Arabia

          Zoho is a popular software platform that offers a wide range of business solutions, from customer relationship management to finance and accounting tools. However, one major drawback for businesses operating in Saudi Arabia is the lack of a payroll feature
        • クライアントスクリプト 新規作成を禁止する

          ■概要 あまりニーズはないと思いますが、、、、Zoho CRM 程度作り込んで来ると「このカスタムタブのレコードは商談から Deluge でコピーしたものだけにしたい」と言う場面になりました。 レコードの新規作成は制御できない様でしたが、保存ボタンはクライアントスクリプトで無効化できることがわかりました。これを使って新規作成したレコード(各項目には何も値が入っていないレコード)保存できない方法をご紹介します。 出典: ZOHO CRM Client Script Disable Save Button
        • 【Zoho CRM】Deluge による自動番号の開始番号リセット

          ■概要 商談番号を「自動番号」フィールドで設定している際、年度が変わったら「開始番号」を 0001 から再度スタートしたい。 参考URL:https://help.zoho.com/portal/de/community/topic/resetting-auto-number-on-new-year ■対応策 「スケジュール処理」に以下の様な関数を組み込み、「自動番号」フィールドのプロパティ「開始番号」を自動で変更する。 ■実行環境 Zoho CRM Plus ■関数 ■関数の解説 ・invokeapi
        • Exploring the Red Robin Food Menu — Need Your Favorites!

          Hi everyone, I’m diving into the Red Robin food menu lately and it’s honestly overwhelming (in a good way!) with all the choices — from gourmet burgers to bottomless sides and seasonal treats. 🍔🍟 Since this is such a helpful community (and after checking
        • Next Page