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.
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      • Sticky Posts

      • Zoho Desk Virtual Meetup: US Central, October 5 - 7, 2021

        After the interactive Virtual Meetups in the other regions, we are starting with the US Central and Midwest regions from October 5 to October 7, 2021. The dates for other regions will be announced soon.  At this event, we will explore the topics which
      • 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
      • Ask the Experts 10: A 5-hour online Q&A on Zoho Desk Best Practices

        Welcome to Zoho Desk's Ask the Experts session! This is a monthly discussion on our  forums; wherein a panel of experts will take on questions  specific to topics related to Zoho Desk. The panel will be available for a 5-hour period and will answer any questions posted here.   Let's begin the year learning some best practices from our experts. In this month's ATE we are opening the floor to questions on how to use Zoho Desk the best way.  If you have a business use case but not sure if Workflow is
      • 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. 
      • Ask the Experts 7: A 5-hour online Q&A on Telephony and Call Module

        Welcome to Ask the Experts session! This is a monthly discussion in forums; each session, a panel of experts will take questions on specific topics related to Zoho Desk. The panel will be available for a 5-hour period and answer any questions posted here. In this month's Ask the Experts, we will take questions on everything related to Telephony and the Call Module in Zoho Desk. We will discuss the following aspects:  Integration with different Telephony vendors Routing calls to agents Converting

      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ






                              ご検討中の方

                                • Recent Topics

                                • Zoho Books | Product Updates | November 2024

                                  Hello users, We are back with exciting new features and enhancements in Zoho Books. From multi-criteria workflows to writing off customer opening balances, discover the new updates designed to make your bookkeeping swift. Attach XRechnung to Invoices
                                • Spell check sucks

                                  Come on guys, it's 2024 and your spell check is completely retarded. You gotta fix it.
                                • Signature image logo not displaying in recipient mail clients

                                  Whenever I send an email to another person the image that forms part of my logo is not displayed just a broken link to: https://mail.zoho.com/mail/ImageSignature?fileName=Email-log.jpg&accountId=47238000000007001&storeName=NN1:-3205531763309921492 I can see the logo because I've got a zoho account and I'm logged on but others without a zoho account can't see it. How do I fix this? Thanks -Martin
                                • Sales Order, what are the statuses under Confirmed and Closed

                                  Hi, I have to build a workflow in Deluge which should be triggered when Sales Order status is Confirmed or Closed. But these 2 states don't exist when you fetch a sales order. Which of the statuses are considered as Confirmed or Closed ? Here is a list
                                • Notifications for calendar meetings

                                  So we have been happy users for a few months now. This is an important problem we face, since I have forgotten meetings already cause of lack of notifications. The problem: I have notifications (email, popup and notifications) set for my calendar by default.
                                • Reusuable Sections & Universal Brand Settings

                                  Zoho Email Campaign setups take longer than other software I've used because it doesn't have reusable sections or universal brand settings (fonts and colors). These enhancements should be added to help us create our campaigns more easily.
                                • Blockchain technology

                                  Blockchain technology is being used to revolutionize accounting and financial reporting. With blockchain, financial transactions are recorded on a decentralized ledger, making tracking transactions and verifying their accuracy easier. This technology
                                • Este domínio já está associado a esta conta

                                  Fui fazer meu cadastro na zoho e quando digitei meu domínio recebi essa mensagem que meu domínio estava associado a uma conta que eu nem faço idéia de quem seja. Como que faço pra resolver isso? Atenciosamente, Anderson Souza.
                                • not able to hit inventory api

                                  when i hit the api with my account keys and the access is provide by the client
                                • Remove County field from Customer Address input screen (or allow input to be deleted)

                                  We are in the USA and have just noticed that there is now a County field in the Customer Address input screen (and maybe other areas of Zoho Books, but this is the one affecting us at the moment). County is not important to our business, and in fact we
                                • 553 Relaying disallowed error

                                  Hi, I am receiving a "553 Relaying disallowed" error when sending emails to my domain email address which I have configured in Zoho. However, I am able to receive emails from my domain email to my gmail account. The SPF and MX entries are all configured
                                • Leads and Deals Issue

                                  Hi! Is Zoho having trouble today? I've been experiencing issues today. When I move a deal to closed/won, it previously would require a closing date but today the screen just went blur and the closing date did not pop up. And then under leads, I was trying
                                • !! URGENT My sent mail goes to spam

                                  I tested a few times and every time I send mail out it goes the recipients spam box.  Why is it marking my mail as spam? please help me ! thanks
                                • Event Time Zone in meeting invites are confusing users

                                  When sending calendar invites to internal and external users, the first section "Event Time Zone" is confusing people and they are automatically declining events. Can this section please be removed??? It already shows the correct time zone next to the
                                • Request For Quotation (RFQ) module

                                  Hello, Do you have any plans to implement a RFQ module in to ZOHO Inventory? I would like to chose items that I require a price for, select a number of different suppliers to e-mail and have them submit there pricing online. I would then like to see a
                                • Constant Sync Errors 🙄

                                  I'm constantly getting sync error notifications with no actual resolution. Also... I have folders and files with a (!) on the cloud icon, indicating it's not accessible. This has also led to the complete loss of certain folders. Like... the go missing!
                                • Display your zoho contact name when they call your mobile number

                                  As per the title If a contact calls the office number, the contacts name shows on mobile as long as I have their contact details registered in my crm. Is there a way that if the contact calls my mobile, their name can be displayed? Currently just their number shows when they call.
                                • In Zoho Projects, is there a way to create a folders template under documents that can be used once a project is created?

                                  We have a specific folder structure that we would like to use that is standard across every project. Instead of having to create this structure every time a project is created, is there a way to create a template for the folders that can be added?
                                • Custom view for Milestones

                                  Hi, Just an idea for the future... would it be possible to create custom views for the Milestones view under Work Overview ? I usually need to look at this view filtered by project group but the filter doesn't remain when navigating away. A custom view
                                • Zoho Books API Limit Is RIDICULOUS!!!!!!!!!!!!!

                                  The 2,500 API call limit in Zoho Books is about as useful as AOL dialup.  Seriously Zoho, not only can I use up 2,500 API calls in no time with my own app but YOUR OWN STUPID IPAD APP blows through them super fast too, so if any one of my clients wants
                                • javax.mail.authenticationfailedexception 535 authentication failed

                                  Hi, I am facing 535 authentication failed error when trying to send email from zoho desktop as well as in webmail. Can you suggest to fix this issue,. Regards, Rekha
                                • Out of Office not working

                                  I have set up out of office on zoho mail, however, it does not reply to every mail sent to it. I have tested it by sending several test messages from multiple different email accounts, I will get a response to some of them, but not all of them this is
                                • Always display images from this sender – Is this feature available?

                                  In Zoho mail, I had my "Load external images" setting set to "Ask me", and that's fine. That's the setting I prefer. What's not fine though is I always need to tick "Display now" for each email I get, regardless if I've done that multiple times from several
                                • Simplify your day-to-day sales operations with new List View actions

                                  Greetings everyone, Here are a few enhancements for quick actions in modular List Views that will make your day-to-day CRM operations much easier. List Views in modules display records in rows and columns based on set criteria, and are useful for presenting
                                • Some emails are not being delivered

                                  I have this problem where some of my mail just seems to disappear. When I send it, it appears as sent with no mention of any problem, but my recipient never gets it, not even in the Spam folder. Same for receiving, I have a secondary e-mail address, and
                                • Unbilled Items Report?

                                  Hello! Is there any way to display a list of items that remain unbilled, without creating an invoice for each customer to see if the unbilled items box is displayed? ;-) Ben
                                • Making Calls Using ZDialer on Zoho Creator Widgets

                                  The Zdialer Browser Extension does not seem to recognize phone numbers on custom widgets. What is the best way to work around this?
                                • ALL sent mails from my zoho email id go to spam

                                  when we send emails out of Zoho as like Gmail , ALL mails go to spam... more than urgent to get a solution !!!!!!
                                • Não consigo enviar e nem receber e-mails

                                  Estou com problemas pra enviar e receber e-mails. Não consigo enviar (recebo uma mensagem de domínio inválido) e os e-mails que recebo estão voltando. Como devo proceder?
                                • Time Field

                                  Good Day, I have a question, when I save a draft and reload it. Why does the time field format keeps goes from hh:mm to hh:mm:ss? Is there a way I can force it to load to hh:mm only? I have tried example = totime(input.TimeField, "hh:mm") in the -created
                                • Receiving email problem

                                  I can send an email but can't receive from other platform like Gmail
                                • Mas de 48 horas sin correo

                                  Estimados, llevamos más de 48 horas sin poder recibir correo y en este periodo hemos recibido información confusa y lo mas relevante es que Zoho dice que esta todo bien y no encuentra el error. Como deben comprender el perjuicio de no contar con un correo
                                • Your account has been blocked due to security reasons.

                                  Hi everyone. Faced a problem that is wreaking havoc on my business! On December 14, blocked login via WEB, IMAP and POP3 with the reason of unusual activity, allegedly because of VPN/Proxy and suspicion that my account was hacked. I created a ticket to
                                • Displaying related quotes in sales order and back

                                  Hi, My colleague liked to see to which sales orders, the quote has been converted. Quote shows Invoices, but not SO. Same, they would like to see the quotes in the sales order, as they can see invoices, packages, shipment, How can we achieve this ? Thank
                                • Details & Limitations of the Free Forever Plan

                                  I cannot find any comparison/details about the Free Forever Plan. Can you please publish details of what are its limitations?
                                • Missing Folders on iPhone Zoho Mail

                                  Under mailboxes on my iPhone, I don't have an inbox, sent folder, deleted photo, etc. See pics.
                                • Functions - How to pass Dynamic Parameters / Arguments?

                                  I am trying to create a generic function that I can use to update a given field with the name of the user and a given field with a datetime. The purpose of this is to have a history of major actions within the CRM record itself so it is easier to query
                                • Query table pull last 12 months

                                  I am tying to pull the following criteria and the date is always what causes me the issue. I want to pull people (pco_id) who have entries of "event_id" being these 2 events and whos "kind" is Regular or Guest and where the event_starts_at (date column)
                                • ChatGPT only summarize in English

                                  Hello i' v enabled chatgpt in salesIQ, it works great inside conversation (revise, Rephrase etc) add tags works well with another language than English. But when I want to summarize it render only in English, despite sales IQ is set to another language.
                                • Vendor Assignment issue for staff in User Roales

                                  there is a limitation in software that we can't assing Vendors to our staff - we can only assign Customers on staff wise!! There is a limitation of this software that in case i want to assign limited vendors to my staff - it's not possible. Either i will
                                • Next Page