HOW TO: Searching a thread (email body/text) with a custom function, allowing filtering and specific actions

HOW TO: Searching a thread (email body/text) with a custom function, allowing filtering and specific actions

We are still trialing out Zoho at this time, but have found a major expected feature to be missing - the ability to search within the text of an email for automation/workflows.

NOTE: You need to create a connection for zohodesk under settings -> Developer Space -> Connections. We named our connection zohodesk with link name 'zohodesk' and under choose scopes select all options.

I am sharing my current solution that may benefit other users needing similar functionality.
  1. For my example I created a Workflow for the Tickets Module.
  2. You can have this execute by any method, I have this execute on create (customer emails).
  3. For Criteria you may add what is necessary, but I have the criteria filtering (by searching email text) within the custom function and have section 3 "Criteria" empty.
  4. For Actions hit '+' and choose 'Custom Functions' (new or existing if you already made this)
Name your custom function something internally identifiable.

The Custom Function:
OrgID = ####;
getthreads = zoho.desk.getRelatedRecords(OrgID,"threads","tickets",ticketId,0,1);
threadid = getthreads.getJSON("data").getJSON("id");
getthreadcontent = zoho.desk.getRelatedRecordById(OrgID,"threads",threadid,"tickets",ticketId).getJSON("content");
if(getthreadcontent.containsIgnoreCase("cancel"))
{
updateticket = zoho.desk.update(OrgID,"tickets",ticketId,{"status":"Cancel"});
info updateticket;
}

Custom Function Notes:
  1. Update OrgID to your organization ID in zohodesk
  2. Replace 'cancel' under if(getthreadcontent.containsIgnoreCase("cancel")) to any keyword/phrase you want to search
  3. Change .containsIgnoreCase to .contains for case sensitive searches
  4. Under updateticket we are updating 'ticket' and the field is 'status' changing it to our custom text of Cancel. Here you can use different modules or fields to update - see full details here: https://www.zoho.com/deluge/help/desk/update-record.html
You can see all values you can update for the 'ticket' module here: https://desk.zoho.com/DeskAPIDocument#Tickets#Tickets_Updateaticket under 'Attributes'

  1. This solution copies the thread (email body) to the description field
  2. The description field does have a limitation on length from my research
  3. Doing this duplicated every thread and showed two conversations
  4. The solution I posted above does not duplicate threads/conversations and allows searchability within the function instead of copying to description and then searching description
  5. Copying description and having another workflow 'search' description does not work as the workflows execute at the same time and the clone to description doesn't complete until after workflows execute.

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Webinar 2: Supercharged customer support for growing business

                                                Join us for this webinar and learn how to step up your support game using a real-time communication platform to generate happier, more successful customers. In this live webinar, we will will discuss the importance of SalesIQ for your support team and how it can help you:  Understand your customers better and their journeys to proactively support and engage them even before they ask for help.  Integrating real time conversations into Zoho Desk’s Support, providing a conversational customer service
                                              • Customize Colors of your Customer Self Service Portal

                                                You asked for it. We heard you. We're happy to roll out the most sought after feature request, Customizing the Colors of your Customer Self-service Portal. Now you can set the color of your customer portal to mimic your company's web site, so that your customers visiting the portal will not feel alienated by the default theme.  Go ahead and configure the color of the header, tabs, fonts and background according to your needs. You can either choose between default color themes like Blue, Grey, Green
                                              • Edit and Delete options in Comments

                                                A lot of teams have been using ticket comments extensively to collaborate everyday. Notification Center further improved this experience by bringing real-time updates. As we continue to build more improvements to this experience, we've shipped a small-yet-important
                                              • 2024 Email Authentication Standards: Elevating Security with Google and Yahoo

                                                In contemporary email communication, email authentication plays a pivotal role in mitigating email fraud, spam, and phishing attacks. Brace yourself for a new level of security. Starting February 2024, Gmail and Yahoo will be implementing robust email
                                              • Announcing the New and Improved Article Editor

                                                KBase articles are known to help customers, find solutions to problems on their own and set the stage for ticket deflection. That said, the way you present your KBase content is the clinching factor that ensures your customers stick around to consume it.  We took it upon ourselves to build an editor that allows you to publish articles without delving into the code. Well, at least for the most part. With more options and a redefined interface, the article editor in Zoho Desk is now better than ever!


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now