Custom script for improved Desk integration

Custom script for improved Desk integration

Good afternoon,

I ended up undertaking a development project to achieve the goal outlined below. I've summarised the project below and attached a PDF copy which covers each stage of the project from end-to-end, this may or may not be of interest to members undertaking dev work in their own Zoho CRM and Desk environments.

First and foremost, the goal:

When we manually create a new Account in Zoho CRM, a Primary contact will be added and then sometimes a Secondary contact, however once the customer is onboarded and services deployed, they can then contact our support desk for assistance and problem reporting... in many cases, the Primary and Secondary Account contact/email do not end up being the people submitting tickets and in all cases they are never the only people to submit tickets.

The native Zoho CRM <> Zoho Desk integration only supports the association of Tickets to accounts by the Primary Email or the Secondary Email, this resulted in a vast swathe of our support desk tickets never being associated to Accounts and nor would future tickets be whenever they were not submitted by a Primary or Secondary contact and so I had to find and implement a fix for this.

And that is where this journey started, I encountered limitations and/or problems at pretty much every step along the way that tested my patience but the perseverence paid off; this automation is now fully operational and working as desired within our CRM and Desk environments and the results are exactly what I was hoping for.

Initial Identified Problems:

1. Automation to create a new Contact and assign it to a correct Account required a different approach and the obvious option was to have this done by matching the email domain from which the Contact has sent an email to our Desk to a custom Email Domain field that we have created and made mandatory in the Accounts layout on CRM (screenshot of field provided under Function 2 within the attached PDF).

This allows our system to automatically capture and associate all Contacts to correct Accounts using a customer's email domain rather than a specific email address and therefore taking away the reliance of the person contacting having to already be saved in our CRM as a Primary or Secondary email on a CRM Account.

2. Next up, it was apparent that automatic Contact creation by Zoho Desk INTO Zoho CRM was not triggering which meant the process was failing at the first hurdle.

2a. What I did notice as I done some more digging... When I opened any new Contact in the desk it became clear that the entire name of the person was being extracted correctly but then auto-filled into the LAST NAME field only with the First Name field left completely blank.

I then manually extracted the first name from the last name field of one Contact and pasted it into the first name field... voila... the Contact then appeared in the CRM instantaneously, I repeated this on a couple more contacts with the same end result.

I then embarked on the below project consisting of a series of custom functions and workflows both Desk-side and CRM-side to create a pipeline of functions that would address the Contact association to Account in CRM, then push the accountId back to the Desk Contact and Ticket which would then result in the Ticket being associated to the Account and thus displaying in the Zoho Desk module within the Accounts view in Zoho CRM with the added benefit of all of the Contact's contact details listed against the Contact in the Ticket view.

Pretty much every step seemed to have a limitation or issue thus requiring a custom function so that each task would be automatically completed in full allowing the next automated step of the process to trigger and that's why I thought I would share this in the community, the attached PDF contains the Workflow Rules, Argument Mapping and Script utilised for each custom function that make up the entire process and therefore individual functions may be of interest or value to some rather than the whole project.

Additionally, if anybody finds themselves in the same/similar predicament and wanting to achieve the same goal then this provides a full start-to-finish pathway for them to achieve the functionality.

Please note that some Scripts are standalone and not part of a Workflow Rule


The Project and Pipeline of Events/Functions is as follows:

1. Customer sends email to our Zoho Desk, this can be any person from the customer's company that is or is not already a listed contact within our CRM.

2. Desk auto-creates a Contact if it doesn't already exist, placing the person's full name in the Last Name field only. (Problem).

3. Workflow with custom function fires on create, custom function extracts First Name from Last Name field, and populates First Name field with the extracted First Name from the Contact (Problem resolved).

4. Desk-to-CRM native sync is now working and syncs the contact to our CRM.

5. CRM workflow then fires on creation of the new Contact, matches the Contact's EMAIL DOMAIN (not the full email) to the correct Account by referencing a custom Email Domain field that I have created within the Accounts Module/Layout (screenshot included in PDF) - This means that the contact does not have to be already listed in the CRM as any new Contact will be added and associated to the correct Account via the custom function matching the Email Domain, e.g. customerdomain.net, instead of name@customerdomain.net.

6. CRM contact is then associated to the correct Account automatically.

7. CRM function also updates the Contact in Zoho Desk with the correct accountId directly via API.

8. Desk Workflow then fires on Ticket create and sets the same accountId on the Ticket via the domain matching - This accountId function is to trigger every time a ticket is created regardless of whether the Contact is newly created or already existing therefore capturing all new tickets.

9. Ticket now visible in Desk Module in the CRM Account too. RESULT!

All of this now achieved without having to rely on Primary or Secondary email as per the native sync.

The attached .pdf covers the project from start to finish, including the scripts implemented for each custom function so you can copy, paste and then simply update the Org ID and email address to your own, please be aware Org ID and email addresses can appear more than once in some of the scripts.

Please note, our Org ID and my Email Address has been partially redacted to protect the information but still presented in a way that clearly indicates how they are entered within the scripts.

Additional note, within the PDF there are a couple of Backfill sections and scripts where I had to create a custom function in the CRM to manually trigger to run through existing Contacts identify those unassociated to any Account then asssociate them to the correct Account.

There was also a Backfill function set up also to manually run and sweep existing tickets to Associate those to correct accountIds too thus ensuring that any submitted prior to this Automation project would also be associated to the correct Accounts.

I hope this helps... I had a big sense of achievement when I successfully completed this journey on Tuesday and saw the functionality happening live and correctly.

      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          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 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

                                  • Track All Emails from Company Domain

                                    For our business model, it's almost impossible to keep track of all emails sent to clients, under the way ZohoCRM currently tracks emails to customer records via the user account only. We'd like to see a way of tracking emails via domain only, separate
                                  • Cannot format "start date" field in Zoho Flow

                                    I am trying to recreate a flow that connects Inventory package creation to Zoho projects (where a task is created in a defined project). I've been able to troubleshoot everything EXCEPT the date fields; specifically the "start date" - which is quite important
                                  • Introducing Incentives for Zoho CRM: Build, automate, and track sales commissions

                                    Dear Customers, We are here with an amazing news! We built a direct solution to help manage your commission provisioning activity in your business. From creating commission plans to issuing payouts, this application leverages your sales reps’ performance
                                  • Dark Mode for ZOHO Recruit

                                    Please make a dark mode for ZOHO Recruit. The white is SO BRIGHT!
                                  • Dashboards for Customers

                                    Is it possible to build dashboards for each customers in the community for their tickets?
                                  • Feature Request - Dedicated "Avail" action for Restricted Holidays (instead of routing through Apply Leave)

                                    Currently, Restricted Holidays in Zoho People are handled through the Leave module. Employees have to go through Apply Leave and select the Restricted Holiday as a Leave Type in order to avail it. From an HR perspective, a Restricted Holiday isn't really
                                  • Deleting invoice (not syncing with Xero)

                                    If I delete an invoice or Bill in Zoho Inventory, it doesn't sync with Xero. So my Xero accounts are not correct. Whats the point of being able to delete a transaction in Zoho if it doesn't sync to my accounting package? How can I do this?
                                  • Allow Clients to choose which meeting platform works best for them

                                    Hi! I have a feature request for Zoho Bookings! I currently have multiple online meeting platforms connected to Zoho Bookings: Zoho Meeting, Zoom Meetings and Teams Meetings. Since we are allowed to connect multiple meeting platforms, it would only make
                                  • Implement Meeting Polls in Zoho Bookings

                                    Dear Zoho Bookings Support Team, We'd like to propose a feature enhancement related to appointment scheduling within Zoho Bookings. Current Functionality: Zoho Bookings excels at streamlining individual appointment scheduling. Users can set availability
                                  • Previewing attachments in email composer (Zoho CRM)

                                    When I am sending an email from a contact's record, when I am in the compose email screen, if I add an attachment to the email, I cannot then click on the attachment to view it to see if it is in fact the correct attachment before sending. In Outlook
                                  • Zoho Lens Feature Update: September 2026

                                    RealWear store support Zoho Lens is now listed on the RealWear marketplace, paving the way for quick and easy deployments. Install it straight to your smart glasses from the marketplace without any cables, pendrives, or manual transfers.
                                  • How are you using AI task management tools in your team

                                    AI is becoming more useful when it can do more than suggest tasks. Having AI agents help with task updates, follow-ups, and repetitive project work could make day-to-day collaboration much smoother. I recently came across Sharkly.ai, which focuses on
                                  • Can Zoho Mail Be Used with Google Workspace Without Migrating Emails?

                                    Hello Zoho Community, We currently use Google Workspace for our company emails and do not want to migrate our email accounts or data to Zoho Mail. However, we would like to use Zoho Mail as an email client, similar to Microsoft Outlook, by connecting
                                  • Topic assignment to a contact list never completes in Zoho Campaigns

                                    Hello, I am experiencing an issue in Zoho Campaigns when trying to assign a Topic to a contact list. When I select a list and try to assign a Topic, Zoho displays the following message: “This process will take a few minutes. You will receive an email
                                  • Subforms and automation

                                    If a user updates a field how do we create an automation etc. We have a field for returned parts and i want to get an email when that field is ticked. How please as Zoho tells me no automation on subforms. The Reason- Why having waited for ever for FSM
                                  • [ZohoDesk] Improve Status View with a new editeble kanban view

                                    A kanban view with more information about the ticket and the contact who created the ticket would be valueble. I would like to edit the fields with the ones i like to see at one glance. Like in CRM where you can edit the canvas view, i would like to edit
                                  • Automating CRM backup storage?

                                    Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
                                  • Zoho Assist Feature Update: September 2026

                                    Custom View Filters in Scheduled Reports Scheduled Custom Reports now support saved Views. Select a View when setting up your schedule, and only the data matching its filter criteria will be delivered to recipients in each email. Without a selected View,
                                  • Tip #89 – Access, print, and manage remote files from your local printer with Remote Printing – 'Insider Insights'

                                    A team member working from home urgently needs a document that's sitting on the office system. The office is locked and nobody is around to access it. Emailing the file means routing a sensitive document through external channels, and that's not something
                                  • Important: Teamwork Projects Integration Moving to API v3

                                    Hello Teamwork Project users, We are migrating the Teamwork Projects integration from the legacy V1 API to V3 API. This upgrade enables support for custom fields from Teamwork Projects, allowing users to import custom modules and fields into Zoho Analytics
                                  • Introducing Night Mode for Zoho Recruit [BETA]

                                    Late-night hiring sessions? Long hours reviewing resumes? We heard you. Night mode [BETA] is now available in Zoho Recruit, giving you a cleaner, more comfortable workspace that’s easier on the eyes while keeping the focus on what matters most: hiring.
                                  • Sent Items folders not syncing on Thunderbird

                                    HI,  I run TB on multiple devices, since the middle of September all the devices have stopped synchronising the sent items folders, all mail is received and sent correctly and stored in my zoho webfolders. I haven't changed any of the settings. Any ideas? This is also the case in my 'paid for' accounts with ZOHO and Thunderbird Many thanks Tony whittingham
                                  • Thunderbird not retrieving Mail automatically

                                    Hi, I have set up Zoho in Thunderbird all fine, the only problem is that the mails are not coming to Thunderbird automatically, they only come when I initially start up Thunderbird,  any ideas for a fix on this cheers
                                  • Free Webinar Alert! Don’t take the bait: Everyday email safety in Zoho Mail

                                    Hello Zoho Community! Think you can spot a suspicious email before it catches you off guard? Join our upcoming webinar, “Don’t take the bait: Everyday email safety in Zoho Mail,” and learn how to recognize common email threats and build safer habits for
                                  • Do you know which 20% of your products generate 80% of your revenue?

                                    Not all products earn their place in your inventory. In almost every catalog, a small group of items drives most of the revenue, while a long tail quietly ties up storage, counting effort, and working capital. The trouble is, most teams treat every SKU
                                  • How can we allocate incoming PO stock to Sales Orders, and does Backorder automatically reserve it upon receipt?

                                    Hello Everyone, We want to allocate incoming Purchase Order quantities to specific Sales Orders before the stock arrives. For example, from an existing PO of 100 pieces: 40 pieces assigned to SO-A. 35 pieces assigned to SO-B. 25 pieces left unallocated.
                                  • Convert an Existing Single Item into an Item with Variants

                                    Hello Zoho Team, Introducing variants is a great addition to Zoho Inventory. However, we would like to request an option to convert an existing single item into an item with variants. For example, Item A initially comes in only one colour, so we create
                                  • inventory removal at packing list or shipment.

                                    currently our system is set to remove inventory at invoice. This is creating an inventory nightmare? Is it possible to change the settings to remove the item from inventory at either the packing slip stage or shipping the item.
                                  • Delug script

                                    I have been looking at auto-update a amount (home currency) field from another module. Zoho native multicurrency was used in the other module (we have 4 here). Custom script was input with no error, but the field was not updated on trigger. Script as
                                  • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

                                    Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
                                  • Allow Email Attachments to Be Opened Directly in Zoho CRM

                                    Hi all, It would be very helpful if attachments linked to an email in Zoho CRM could be clicked and opened directly from the email preview. Currently, the attachment names are displayed, but the experience of viewing them is unnecessarily limited. Users
                                  • GEO and Zoho Desk

                                    Has anyone done anything with GEO (generative engine optimization) and zoho desk KB? Are there any plans from Zoho on adding the ability in inject GEO scripts in KB Articles?
                                  • How to add custom lookup-type field to meeting module form in Zoho CRM

                                    We need to have a lookup field to a custom module's record in Zoho CRM. But it appears that look-up fields are not enabled in Meetings/Events module in Zoho CRM. How do I design/implement a custom look-up type field that will lookup records from custom
                                  • AI-Powered Automation for Repetitive Tasks

                                    Incorporating AI into Zoho People can streamline and automate repetitive administrative tasks, boosting productivity and efficiency. Automate Data Entry: Use AI to auto-capture and input data from emails and forms, reducing errors. Schedule Management:
                                  • Rotate an Image in Workdrive Image Editor

                                    I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
                                  • [IDEA] Bring Layout - Conditional Rules and Client Scripts to Zoho Books

                                    The problem We run Zoho Books with two e-invoicing integrations: myData (Greek tax authority, AADE) and PEPPOL (EU e-invoicing). Between the two, our Invoice form carries a large number of custom fields — document type codes, VAT exemption categories,
                                  • Last four Digit field in Zoho Payment Received

                                    One of our client's payment received doc has Notes, Last four digit and Transaction ID fields set, I couldn't find api parameter for these fields in the documentation... when I checked the site, it's not custom fields as well. where do i find it, any
                                  • Automatically remove commas

                                    Team, Please be consistent in Zoho Books. In Payments, you have commas here: But when we copy and paste the amount in the Payments Made field, it does not accept it because the default setting is no commas. Please have Zoho Books remove commas autom
                                  • Show my cost or profit while creating estimate

                                    Hi, While creating estimate it becomes very important to know exact profit or purchased price of the products at one side just for our reference so we can decide whether we can offer better disc or not .
                                  • Cash Flow Forecast Dashboard in Zoho Reports

                                    I am exploring the capabilities of Zoho Reports and created a simplified Cash Flow Dashboard - http://db.zoho.com/ZDBDataSheetView.cc?DBID=97137000000016024 This is just a sample of the useful financial information for small businesses that can be created with this powerful business intelligence tool from Zoho.
                                  • Next Page