Zoho People - CRM Integration

..

What is this feature? & Why is it used?

This feature provides a bridge between Zoho People & Zoho CRM.
this Integration helps in viewing the jobs assigned in Zoho People within the Zoho CRM product.

Description

Through the existing integration between Zoho People and Zoho CRM, Users can import the Leads/Contacts/Accounts/Deals from Zoho CRM as "Clients" into Zoho People. Also, in Zoho CRM, using related list, the jobs from Zoho People that are associated with those Leads/Contacts/Accounts/Deals which are already imported into Zoho People can be listed. To achieve this, AUTHROKENS are being used in related lists. However, since AUTHTOKENS are being deprecated shortly, users are required to remove existing related lists from the records (Leads/Contacts/Accounts/Deals) and instead use CONNECTIONS in Zoho CRM for the same related lists to achieve similar functionality. This will be explained further below.

Removing Existing Related Lists:

  1. Select any record (Lead/Account/Contact/Deal) where the related list "getTimeSheetJobsfromZohoPeople" which is used to fetch jobs from Zoho People is currently used.

  1. Select and Delete ​related list

Existing method:

Refer this link to know how it is currently done. (Old Method)

New Recommended Method:

Creating the connection in CRM:

1. Go to Settings -> Developer Space -> Connections -> Click Add Connection.  Now select Zoho People

2. A window will appear where the below details are to be provided

i) Connection name - Any name to identify the connection.
ii) Connection Link name - This will be used in the function code. Here enter "zohopeople" or any name as required
iii) Scope - Select the scopes needed. Here "ZOHOPEOPLE.timetracker.all" is used to fetch the jobs from Zoho People.

3. Click Create and Connect.

4. A window shown below will appear asking for your permission to make use of Zoho People's APIs for this connection. Click Accept to continue.

Creating the custom function in CRM:

1. Go to Settings -> Developer Space -> Functions -> Click New Function

  A popup window will appear where the following details are to be filled:

i) Function Name : Name of the function. Here, we have entered "getJobsFromZohoPeople".

ii) Display Name : Display name of the function which is to identify the function.

iii) Description : A short description to indicate what this function does (optional).

iv) Category : Select Related List.

2. Now click Next

3. A text box will appear. Copy paste the below code:. Please replace 'CONNECTIONLINKNAME' in the code with the connection link name provided when the connection is created.

response = "<error><message>No records found.</message></error>";
url = "https://people.zoho.com/people/api/timetracker/getjobs?zohoCRMReferenceId=" + zohoCRMReferenceId;
apiResponse = invokeurl
[
url :url
type :GET
connection: "'CONNECTIONLINKNAME'"
];
if(!apiResponse.isEmpty() && apiResponse.containsKey("response"))
{
responseJSON = apiResponse.getJSON("response");
if(responseJSON.containKey("result"))
{
result = responseJSON.getJSON("result").toJSONList();
if(!result.isEmpty())
{
response = "<record>";
for each index x in result
{
response = response + "<row no=\"" + x + 1 + "\">";
rowvalue = result.get(x);
jobStatus = rowvalue.getJSON("jobStatus");
jobName = rowvalue.getJSON("jobName");
if(rowvalue.contains("totalhours"))
{
totalhours = rowvalue.getJSON("totalhours");
}
else
{
totalhours = "00:00";
}
toDate = "";
if(rowvalue.contains("toDate"))
{
toDate = rowvalue.getJSON("toDate");
}
fromDate = "";
if(rowvalue.contains("fromDate"))
{
fromDate = rowvalue.getJSON("fromDate");
}
hours = rowvalue.getJSON("hours");
response = response + "<FL val='Job Name'>" + jobName + "</FL>";
response = response + "<FL val='Status'>" + jobStatus + "</FL>";
response = response + "<FL val='From'>" + fromDate + "</FL>";
response = response + "<FL val='To'>" + toDate + "</FL>";
response = response + "<FL val='Estimated Hours'>" + hours + "</FL>";
response = response + "<FL val='Logged Hours'>" + totalhours + "</FL>";
response = response + "</row>";
}
response = response + "</record>";
}
}
}
return response;

4. Click Edit Arguments which can be seen in the top left corner of the text box.

5. Set the parameter name as "zohoCRMReferenceId" and type as "string" and then click Save.

6. Click Save to save the function code.

Adding related list to the record

Now this function can be used in any related list to fetch the jobs associated with any Lead/Account/Contact/Deal in Zoho People.​

..

Example:

As an example, let's try to use this function for a Lead. 

1. Open any Lead record and click Add Related List option in the left tab.

2. A window will pop up showing the available options. Select Functions. A list of functions already created will be listed.

3. Add the function that we have created.

4. A pop-up window will appear asking for the param value. In the param value textbox, type '#' and then select the module Leads and select the field Lead Id as we're adding this function for a Lead. 

   Param value should be configured as shown below based on the record type

Record TypeModuleField
LeadsLeadsLead Id
ContactsContactsContact Id
AccountsAccountsAccount Id
DealsDealsDeal Id

5. Click Save

Now this related list will fetch the jobs associated with the corresponding Lead from Zoho People.​