Extension pointers for integrating Zoho CRM with Zoho products #4: Handle and keep track of your Zoho Mail for deals within Zoho CRM

Extension pointers for integrating Zoho CRM with Zoho products #4: Handle and keep track of your Zoho Mail for deals within Zoho CRM

Regular email communication with Zoho CRM contacts, before or after signing or closing a deal, is a key component of effective customer relationship management. Having a separate section within the record page in Zoho CRM for emails associated with a specific deal makes it simple and easy to check the respective email data and set up further follow-ups.

In this post, we'll take a look at how to integrate Zoho Mail with Zoho CRM.

Consider the following scenario: A sales representative successfully closes and wins a deal. For the deal to close successfully, multiple emails will have been exchanged, along with several other emails in the future. Having all of the emails received from the deal's contact in your Zoho CRM as a related list in your deal's record can help you manage this data better.

Creating a connector for Zoho Mail and adding connector APIs
  • Create a new connector in your extension for Zoho Mail using the Connectors feature under Utilities in the left panel of the Zoho Developer console. 
Note: Zoho Mail follows OAuth2.0 protocols for authentication. You can refer to this post to better understand the steps to register Zoho Desk and retrieve your client credentials.

                                    

The connector details for our example are:
  • Add the necessary connector APIs for your functionality. Please refer to the Zoho Mail API guide for details. 
                                    
The Zoho Mail APIs added for our example are mentioned below.

Note: You can refer to this post to learn about the detailed steps involved in creating a connector, adding the connector APIs, and associating it with the extension.

Creating a related list and associating a function to it

Create a related list called "Related mails" using the Related details option present in the Components feature available in the Build section of the Zoho Developer console, then associate a function to perform the desired action.

Related mails - Related list code snippet

//Retrieving the deal record and fetching the deal name, contact name and contact ID
response = zoho.crm.getRecordById("Deals",deal.get("Deals.ID").toLong());
dealname = response.get("Deal_Name");
dealname = dealname.trim().toUpperCase();
dealname = replaceAll(dealname," ","_");
contact = response.get("Contact_Name");
id = contact.get("id");
// Retrieving the email ID of the contact associated with the deal by passing the id retrieved
response1 = zoho.crm.getRecordById("Contacts",id);
email = response1.get("Email");
dynamic_map = Map();
// Invoking the get account details API to fetch the account ID
response2 = zoho.crm.invokeConnector("jssdkextension.zohomail.getaccountsdetails",dynamic_map);
resp = response2.get("response");
data = resp.get("data");
for each item in data
{
zuid = item.get("zuid");
info zuid;
accountid = item.get("accountId");
info accountid;
}
dynamic_map = Map();
dynamic_map.put("accountId",accountid);
dynamic_map.put("emailid",email);
dynamic_map.put("dealname",dealname);
// Invoking the search results API to get the emails associated with the deal and contact of the deal
response3 = zoho.crm.invokeConnector("jssdkextension.zohomail.searchresults",dynamic_map);
info response3;
responsedata1 = response3.get("response");
data1 = responsedata1.get("data");
info data1;
// Constructing the related list
resp = "";
count = 1;
recordsXmlStr = "<record>";
for each value in data1
{
recordsXmlStr = recordsXmlStr + "<row no='" + count + "'>";

recordsXmlStr = recordsXmlStr + "<FL val='Subject'>" + value.get("subject") + "</FL>";
recordsXmlStr = recordsXmlStr + "<FL val='Summary'>" + value.get("summary") + "</FL>";
recordsXmlStr = recordsXmlStr + "<FL val='Sender'>" + value.get("sender") + "</FL>";
recordsXmlStr = recordsXmlStr + "</row>";
count = count + 1;
}
recordsXmlStr = recordsXmlStr + "</record>";
resp = resp + recordsXmlStr;
return resp;

  • The deal record details are fetched using the getRecord API and the deal name along with the contact name is retrieved from it. Similarly, the contact ID is passed to the getRecord API for the contacts module from which the contact's email ID is retrieved.
  • The account ID is also retrieved by invoking the get account details API.
  • This account ID is passed to the search results API along with the deal name and the email ID retrieved which are the search criteria for the mails to be filtered and displayed as a related list.
Now let's see a sample output of how this functionality works.

When a deal record is opened, the emails in the Zoho Mail account having the sender as the deal's contact's email address, and the deal name as a part of the mail are fetched and displayed as a related list.



This way you can integrate Zoho CRM with Zoho Mail, and the functionality can be enhanced based on your business requirements.

We hope you find this information useful. Keep following this space for more tips and recommendations!


SEE ALSO





                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


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

                                                                    





                                                                    




                                                                        Design. Discuss. Deliver.

                                                                        Create visually engaging stories with Zoho Show.

                                                                        Get Started Now