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.